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

Core: Dart LSP #9

Open
1 of 3 tasks
5hirish opened this issue May 22, 2023 · 5 comments
Open
1 of 3 tasks

Core: Dart LSP #9

5hirish opened this issue May 22, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@5hirish
Copy link
Owner

5hirish commented May 22, 2023

Language Server Protocol (LSP) support is available in the Dart analysis server from version 2.2.0 of the SDK (which was included in version 1.2.1 of Flutter).

This issue outlines the scope of LSP methods to be implemented in the tagged milestone.
Full list of LSP methods integrated in the quinine Dart LSP client. dart-lang/sdk
(Following implementations subjected to methods implemented at the Dart LSP server)

Method Progress Milestone
initialize M1
initialized M1
shutdown M1
exit M1
$/cancelRequest
$/progress
client/registerCapability ☑️ M2
client/unregisterCapability ☑️ M2
textDocument/definition M3
textDocument/hover M3
textDocument/completion M3
textDocument/publishDiagnostics M3
textDocument/prepareCallHierarchy M3
textDocument/didChange M2
textDocument/didClose M2
textDocument/didOpen M2
window/logMessage M2
window/showMessage M2
workspace/configuration M2
window/workDoneProgress/create ☑️ M2
window/workDoneProgress/cancel ☑️ M2

Milestones

  • Implement and integrate lifecycle messages + Implement Dart LSP provider (M1)
  • Implement document synchronisation (M2)
  • Implement language features (M3)

Running the Server

Start the language server using the dart language-server command. Pass the --client-id and --client-version flags to identify your editor/plugin and version:

dart language-server --client-id my-editor.my-plugin --client-version 1.2

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.

References:

@5hirish 5hirish self-assigned this May 22, 2023
@5hirish 5hirish converted this from a draft issue May 22, 2023
@5hirish 5hirish added this to the alpha-july milestone May 22, 2023
@5hirish
Copy link
Owner Author

5hirish commented May 28, 2023

Confirming compatibility with the existing code-editor : akvelon/flutter-code-editor#240

@5hirish
Copy link
Owner Author

5hirish commented Aug 5, 2023

On first attempt of workspace selection LSP server initiation doesn't happen. Only after subsequent ones it initiates.

void changeDirectoryPath(String? directoryPath) {
initializeLSP(directoryPath!);
state = directoryPath;
}

@5hirish 5hirish added enhancement New feature or request help wanted Extra attention is needed labels Aug 6, 2023
@5hirish
Copy link
Owner Author

5hirish commented Aug 20, 2023

Came across an issue where the provider was starting two LSP server process. Need a test case to ensure only one process is started.

@5hirish 5hirish pinned this issue Aug 20, 2023
@5hirish
Copy link
Owner Author

5hirish commented Aug 24, 2023

Pending M2:

  1. Client should maintain the server's capabilities after it responds to client's initlialize request. The server can signal the following capabilities.. For example, client requires to know the extent of support provided by the server for workspace/executeCommand.
  2. Client should maintain the server's client/registerCapability request in order to enable the various features / capabilities on the client (IDE) side as required. Options necessary for the registration. For example when implementing textDocument/didChange, client needs to register how documents are synced to the server (incremental or full). Hence, it must maintain this request received from the server in order to comply with the server capabilities.

@5hirish
Copy link
Owner Author

5hirish commented Sep 2, 2023

Dart LPS document syncKind with the server is 2. Meaning documents are synced by sending the full content on open. After that only incremental updates to the document are sent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: 🏗 In progress
Development

No branches or pull requests

1 participant