Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LSP] Add textDocument/references & prepareRename, Enhancements for resolving symbols #79988

Closed
wants to merge 59 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
694f133
Add `==` for lsp Position and Range
Booksbaum Jul 28, 2023
e16bf58
Remove `SymbolInformation`
Booksbaum Jul 28, 2023
7f56f29
Emit no `children` element when there are no `children`
Booksbaum Jul 28, 2023
2da094d
Note if a symbol is local to a script file
Booksbaum Jul 28, 2023
0f39373
Add & Enable `references`
Booksbaum Jul 28, 2023
232592d
Add `ReferenceParams`
Booksbaum Jul 28, 2023
4805fc1
Implement `references`
Booksbaum Jul 28, 2023
7598f63
Use `find usages` methods for `rename`
Booksbaum Jul 28, 2023
f07f438
Fix: cannot find reference/rename variable declared in other script
Booksbaum Jul 28, 2023
08116b0
Fix: `resolve_symbol` resolves parameter to its function
Booksbaum Jul 28, 2023
ec3f941
Add `textDocument/prepareRename`
Booksbaum Jul 28, 2023
d344685
Change `prepareRename` to return `range`
Booksbaum Jul 28, 2023
1698f73
Format code
Booksbaum Jul 28, 2023
b7ba9a6
Enhancement: `get_identifier_under_position` (& `resolve_symbol`) now…
Booksbaum Jul 28, 2023
cb1a06f
Enhancement: handle `includeDeclaration` in `textDocument/references`
Booksbaum Jul 28, 2023
fe0ebc1
Add rename-is-valid check to `textDocument/rename`
Booksbaum Jul 28, 2023
2723f74
Add LSP test suite (`[Modules][GDScript][LSP]`)
Booksbaum Jul 28, 2023
3cd3226
Change LSP tests to use inline markers
Booksbaum Jul 28, 2023
6073cd1
Fix/Adjust ranges in `DocumentSymbol`
Booksbaum Jul 28, 2023
5d4c46b
Fix: Incorrect Position when `\t` somewhere before column
Booksbaum Jul 28, 2023
ecbf032
Add more tests for ranges & indentation
Booksbaum Jul 28, 2023
c0bb4f9
Simplify `find_all_usages`
Booksbaum Jul 28, 2023
f9f1a65
Add: Check for all names unique in tests
Booksbaum Jul 28, 2023
65f5ecc
Fix: Char after Cursor gets lost while marking Cursor in String
Booksbaum Jul 28, 2023
e954647
Add: Check for errors in GDScripts used in tests
Booksbaum Jul 28, 2023
f7ab8b1
Rename SUBCASEs
Booksbaum Jul 28, 2023
fd1e2da
Enhancement: Only return non-local `DocumentSymbol`s
Booksbaum Jul 28, 2023
d4c9a0f
Fix: resolve_symbol resolves to wrong symbol in certain cases
Booksbaum Jul 28, 2023
b9d73c9
Use docs from GDScriptParser instead of extra doc parser
Booksbaum Jul 28, 2023
26a44d7
Handle lambda in fields
Booksbaum Jul 28, 2023
e27c1b6
Add: Test front and back of identifiers too
Booksbaum Jul 28, 2023
0a11358
Add some safety check & tests for lsp Position to Godot Position
Booksbaum Jul 28, 2023
c7f7b79
Fix: `GDScriptLanguage::lookup_code` cannot resolve inner class
Booksbaum Jul 28, 2023
bc49f1f
Partial Fix: Cannot resolve Values in Named Enum
Booksbaum Jul 28, 2023
8ea1cf1
Add test for ctor
Booksbaum Jul 28, 2023
4bafe99
Fix: Cannot resolve variable decl when shadowing variable with same name
Booksbaum Jul 28, 2023
cc5b77c
Fix: properties with extra get/set functions throw exception in `Exte…
Booksbaum Jul 28, 2023
389faf3
Enhancement: Run following tests if a `resolve_symbol` returns null
Booksbaum Jul 28, 2023
a81d8c1
Remove unused symbol
Booksbaum Jul 28, 2023
430ecf9
Add more nested class tests
Booksbaum Jul 28, 2023
a972f8b
Note about `resolve_symbol` inside comments & strings
Booksbaum Jul 28, 2023
56efcef
Inline `==` for Position & Range
Booksbaum Jul 28, 2023
1d7a6f0
Fix: in tests on Windows: unescaped `:` (`C:/...`) in `root_uri`
Booksbaum Jul 28, 2023
5055289
Cleanup
Booksbaum Jul 28, 2023
8531623
Fix: Range for GoTo Definition/Declaration spans getter/setter
Booksbaum Jul 28, 2023
9322115
Adjust comments to upper case sentences
Booksbaum Jul 28, 2023
9bd8b8c
Use `p_` prefix for parameters
Booksbaum Jul 28, 2023
80ed1c4
Adjust includes
Booksbaum Jul 28, 2023
3871a2a
Space after `//`
Booksbaum Jul 28, 2023
77e3096
Pass by reference
Booksbaum Jul 28, 2023
e3482de
Comments
Booksbaum Jul 28, 2023
4c2c9de
More comments
Booksbaum Jul 28, 2023
5227442
include `gdscript_analyzer` with `modules`
Booksbaum Jul 28, 2023
5670d21
Add default case
Booksbaum Jul 28, 2023
4d2ddab
Fix: missing `break`
Booksbaum Jul 28, 2023
83cc3a8
Consume `GodotPosition` in `GodotRange` ctor
Booksbaum Jul 28, 2023
6e45ce7
`finish_language` after tests
Booksbaum Jul 29, 2023
1a8d10c
Fix: LSP tests fail when run together with GDScript tests
Booksbaum Jul 29, 2023
ea0b97a
Guard LSP tests behind `TOOLS_ENABLED`
Booksbaum Jul 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enhancement: Run following tests if a resolve_symbol returns null
-> `Check` instead of `Require`
  • Loading branch information
Booksbaum committed Jul 28, 2023
commit 389faf3e7cf21eae985ffb9e8dc2aee4356e2c24
10 changes: 6 additions & 4 deletions modules/gdscript/tests/test_lsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,13 @@ const lsp::DocumentSymbol *test_resolve_symbol_at(const String &p_uri, const lsp

lsp::TextDocumentPositionParams params = posIn(p_uri, p_pos);
const lsp::DocumentSymbol *symbol = workspace->resolve_symbol(params);
REQUIRE(symbol);
CHECK(symbol);

CHECK_EQ(symbol->uri, p_expected_uri);
CHECK_EQ(symbol->name, p_expected_name);
CHECK_EQ(symbol->selectionRange, p_expected_range);
if (symbol) {
CHECK_EQ(symbol->uri, p_expected_uri);
CHECK_EQ(symbol->name, p_expected_name);
CHECK_EQ(symbol->selectionRange, p_expected_range);
}

return symbol;
}
Expand Down