Skip to content

Commit da7d4ed

Browse files
committed
Fix crash when hovering over function type definitions
1 parent 67d2932 commit da7d4ed

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- Fix crash when hovering over function type definitions
12+
913
## [1.7.0] - 2022-07-16
1014

1115
### Added

src/Workspace.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ std::optional<lsp::Hover> WorkspaceFolder::hover(const lsp::HoverParams& params)
236236
}
237237
else if (auto ftv = Luau::get<Luau::FunctionTypeVar>(*type))
238238
{
239-
types::NameOrExpr name = exprOrLocal.getExpr();
239+
types::NameOrExpr name = "";
240240
if (auto localName = exprOrLocal.getName())
241-
{
242241
name = localName->value;
243-
}
242+
else if (auto expr = exprOrLocal.getExpr())
243+
name = expr;
244244
typeString = codeBlock("lua", types::toStringNamedFunction(module, ftv, name, scope));
245245
}
246246
else if (exprOrLocal.getLocal() || node->as<Luau::AstExprLocal>())

0 commit comments

Comments
 (0)