|
| 1 | +# Language Server Protocol |
| 2 | + |
| 3 | +## LSP Support Status |
| 4 | + |
| 5 | +Support for [the Language Server Protocol](https://microsoft.github.io/language-server-protocol/) (LSP) is **not production ready** but available as a preview to allow testing/integration work. |
| 6 | + |
| 7 | +## Running the Server |
| 8 | + |
| 9 | +Run the server from source to ensure you're running code that matches the status shown below. If you don't have a locally built SDK then a recent nightly should do. Pass the `--lsp` flag to start the server in LSP mode: |
| 10 | + |
| 11 | +``` |
| 12 | +dart pkg/analysis_server/bin/server.dart --lsp |
| 13 | +``` |
| 14 | + |
| 15 | +Note: In LSP the client makes the first request so there is no obvious confirmation that the server is working correctly until the client sends an `initialize` request. Unlike standard JSON RPC, [LSP requires that headers are sent](https://microsoft.github.io/language-server-protocol/specification). |
| 16 | + |
| 17 | +## Message Status |
| 18 | + |
| 19 | +Below is a list of LSP methods and their implementation status. |
| 20 | + |
| 21 | +- Method: The LSP method name |
| 22 | +- Basic Impl: This method has a basic implementation but may not support all capabilities |
| 23 | +- Capabilities: All client capabilities (in the spec at time of writing) are supported/handled correctly |
| 24 | +- Tests: Has automated tests |
| 25 | +- Tested Client: Has been manually tested in at least one LSP client editor |
| 26 | + |
| 27 | +| Method | Basic Impl | Capabilities | Tests | Tested Client | Notes | |
| 28 | +| - | - | - | - | - | - | |
| 29 | +| initialize | ✅ | | ✅ | ✅ | trace and other options NYI |
| 30 | +| initialized | ✅ | ✅ | ✅ | ✅ | |
| 31 | +| shutdown | ✅ | ✅ | ✅ | ✅ | supported but does nothing | |
| 32 | +| exit | | | | | | |
| 33 | +| $/cancelRequest | | | | | ignored (unsupported) | |
| 34 | +| window/showMessage | ✅ | | | | |
| 35 | +| window/showMessageRequest | | | | | |
| 36 | +| window/logMessage | ✅ | | | | |
| 37 | +| telemetry/event | | | | | |
| 38 | +| client/registerCapability | | | | | unused, but should be used for DocumentSelector at least |
| 39 | +| client/unregisterCapability | | | | | |
| 40 | +| workspace/didChangeWatchedFiles | | | | | unused, server does own watching | |
| 41 | +| workspace/symbol | | | | | |
| 42 | +| workspace/executeCommand | ✅ | ✅ | ✅ | ✅ | |
| 43 | +| workspace/applyEdit | ✅ | ✅ | ✅ | ✅ | |
| 44 | +| textDocument/didOpen | ✅ | ✅ | ✅ | ✅ | |
| 45 | +| textDocument/didChange | ✅ | ✅ | ✅ | ✅ | |
| 46 | +| textDocument/willSave | | | | | |
| 47 | +| textDocument/willSaveWaitUntil | | | | | |
| 48 | +| textDocument/didClose | ✅ | ✅ | ✅ | ✅ | |
| 49 | +| textDocument/publishDiagnostics | ✅ | ✅ | ✅ | ✅ | |
| 50 | +| textDocument/completion | ✅ | | ✅ | | |
| 51 | +| completionItem/resolve | | | | | not required | |
| 52 | +| textDocument/hover | ✅ | | ✅ | | |
| 53 | +| textDocument/signatureHelp | ✅ | | ✅ | | correct trigger character handling outstanding |
| 54 | +| textDocument/definition | ✅ | | ✅ | | |
| 55 | +| textDocument/typeDefinition | | | | | |
| 56 | +| textDocument/implementation | | | | | |
| 57 | +| textDocument/references | ✅ | | ✅ | | |
| 58 | +| textDocument/documentHighlight | | | | | |
| 59 | +| textDocument/documentSymbol | ✅ | | ✅ | | |
| 60 | +| textDocument/codeAction (sortMembers) | ✅ | ✅ | ✅ | ✅ | |
| 61 | +| textDocument/codeAction (organiseImports) | ✅ | ✅ | ✅ | ✅ | |
| 62 | +| textDocument/codeAction (refactors) | | | | | |
| 63 | +| textDocument/codeAction (assists) | | | | | |
| 64 | +| textDocument/codeAction (fixes) | | | | | |
| 65 | +| textDocument/codeLens | | | | | |
| 66 | +| codeLens/resolve | | | | | |
| 67 | +| textDocument/documentLink | | | | | |
| 68 | +| documentLink/resolve | | | | | |
| 69 | +| textDocument/formatting | ✅ | ✅ | ✅ | ✅ | |
| 70 | +| textDocument/rangeFormatting | | | | | requires support from dart_style? |
| 71 | +| textDocument/onTypeFormatting | ✅ | ✅ | ✅ | ✅ | |
| 72 | +| textDocument/rename | | | | | |
| 73 | +| textDocument/prepareRename | | | | | |
| 74 | +| textDocument/foldingRange | | | | | |
| 75 | + |
0 commit comments