Skip to content

Implement LSP textDocument/definition #18626

@abonie

Description

@abonie

Implement the textDocument/definition endpoint for the F# LSP server. This endpoint will provide the "go to definition" functionality.

The LSP specification for this endpoint can be found under this link.

The implementation should use the F# Compiler Service API: src/Compiler/Service/service.fsi

The current implementation of this feature can serve as a reference point. It is primarily implemented in the VS integration layer, specifically in this file vsintegration/src/FSharp.Editor/Navigation/GoToDefinition.fs. The main idea is to parse and check the source file and then use the GetDefinitionLocation method of the checker's result.

Other LSP endpoints in the F# LSP server can be found here for reference: src/FSharp.Compiler.LanguageServer/Handlers/LanguageFeaturesHandler.fs. F# LSP server is using Common Language Server Protocol Framework which contains useful types and methods for handling LSP requests. It's implementation can be found in the Roslyn repo, specifically https://github.com/dotnet/roslyn/tree/main/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework

Metadata

Metadata

Assignees

Labels

Projects

Status

New

Relationships

None yet

Development

No branches or pull requests

Issue actions