dotnet / dotnet/fsharp

Implement LSP `textDocument/definition`

Open
#18,626 0 comments 1 reaction 1 assignee Assigned to @Copilot View on GitHub
Area-LSP Feature Request
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 22h
Merged PRs (30d)
144

Description

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](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_definition).

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.