File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff 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+ - Fixed document symbol crash on incomplete functions
12+
913## [ 1.16.1] - 2023-01-30
1014
1115### Fixed
Original file line number Diff line number Diff line change @@ -91,20 +91,19 @@ struct DocumentSymbolsVisitor : public Luau::AstVisitor
9191 bool comma = false ;
9292 for (auto * arg : func->args )
9393 {
94- LUAU_ASSERT (func->argLocation );
95- createLocalSymbol (arg, func->argLocation .value ());
94+ createLocalSymbol (arg, func->argLocation .value_or (func->location ));
9695 if (comma)
9796 detail += " , " ;
9897 detail += arg->name .value ;
9998 comma = true ;
10099 }
101100 if (func->vararg )
102101 {
103- LUAU_ASSERT ( func->argLocation );
102+ auto enclosingPosition = func->argLocation . value_or (func-> location );
104103 lsp::DocumentSymbol symbol;
105104 symbol.name = " ..." ;
106105 symbol.kind = lsp::SymbolKind::Variable;
107- symbol.range = {textDocument->convertPosition (func-> argLocation -> begin ), textDocument->convertPosition (func-> argLocation -> end )};
106+ symbol.range = {textDocument->convertPosition (enclosingPosition. begin ), textDocument->convertPosition (enclosingPosition. end )};
108107 symbol.selectionRange = {
109108 textDocument->convertPosition (func->varargLocation .begin ), textDocument->convertPosition (func->varargLocation .end )};
110109
You can’t perform that action at this time.
0 commit comments