-
Notifications
You must be signed in to change notification settings - Fork 1
feat(lsp): hover, document symbols, go-to-definition and smarter completion 🔍 #164
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
232d296
feat(lsp): add hover, document symbols, go-to-definition and smarter …
timfennis e81f2e4
docs(lsp): document editor support and update extension capabilities 📝
timfennis d16ff9d
fix(lsp): correct hover/go-to-def shadowing and scope-aware locals 🩹
timfennis e5a491a
fix(lsp): count LSP columns in UTF-16 code units 🔤
timfennis e4bccb6
fix(lsp): don't run AST features against stale source mid-edit đźš§
timfennis 34d9317
fix(lsp): gate local completion on fresh analysis đźš§
timfennis afbcdc5
fix(lsp): make document state robust to overlapping async edits 🛡️
timfennis 89cf627
fix(lsp): scope bindings after their initializer; serialize close/pub…
timfennis 9720244
fix(lsp): go-to-definition from assignment targets 🎯
timfennis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Editor support | ||
|
|
||
| Andy C++ ships a language server (LSP) so editors can offer rich feedback as you | ||
| write `.ndc` files. The server is built into the `ndc` binary and is started with: | ||
|
|
||
| ```bash | ||
| ndc lsp --stdio | ||
| ``` | ||
|
|
||
| Most users don't run this by hand — the [VS Code extension](https://open-vsx.org/) | ||
| launches it automatically. Any LSP-capable editor can use it by pointing at the | ||
| `ndc lsp --stdio` command for the `andy-cpp` language and the `.ndc` file extension. | ||
|
|
||
| ## What the language server provides | ||
|
|
||
| - **Diagnostics** — lexer, parser, and semantic/type errors are reported inline as | ||
| you type. | ||
| - **Inlay type hints** — inferred types are shown after `let` bindings and function | ||
| parameters, and inferred return types after function signatures. Hints are only | ||
| shown where you didn't already write an annotation. | ||
| - **Hover** — hovering an expression shows its inferred type; hovering a built-in | ||
| function shows its signature and documentation. | ||
| - **Completion** — typing `.` offers functions whose first parameter accepts the | ||
| receiver's type (method-call style). General completion offers built-in functions, | ||
| in-scope variables, and language keywords. | ||
| - **Document symbols** — an outline of the top-level and nested functions and | ||
| variable declarations in the file. | ||
| - **Go-to-definition** — jump from a variable or function usage to its declaration. | ||
|
|
||
| ## Notes | ||
|
|
||
| - The server uses full-document synchronisation and re-analyses on each edit. | ||
| - While the buffer is mid-edit and doesn't parse, the last successful analysis is | ||
| retained so hints and dot-completion keep working. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.