Skip to content

Commit

Permalink
feature: disable code lens by default
Browse files Browse the repository at this point in the history
This feature seems to annoy quite a few users so we disable it by
default. It can be enabled through configuration.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

<!-- ps-id: 4dd3b3fc-5f88-48df-b6a9-8792dde164b4 -->
  • Loading branch information
rgrinberg committed Jun 11, 2023
1 parent 16c2d41 commit 56838b1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Fixes

- Disable code lens by default. The support can be re-enabled by explicitly
setting it in the configuration. (#..)

- Fix initilization of `ocamlformat-rpc` in some edge cases when ocamlformat is
initialized concurrently (#1132)

Expand Down
2 changes: 1 addition & 1 deletion ocaml-lsp-server/src/config_data.ml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,6 @@ let _ = yojson_of_t
[@@@end]

let default =
{ codelens = Some { enable = true }
{ codelens = Some { enable = false }
; extended_hover = Some { enable = false }
}
4 changes: 2 additions & 2 deletions ocaml-lsp-server/src/ocaml_lsp_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,8 @@ let on_request :
| TextDocumentCodeLensResolve codeLens -> now codeLens
| TextDocumentCodeLens req -> (
match state.configuration.data.codelens with
| Some { enable = true } | None -> later text_document_lens req
| Some _ -> now [])
| Some { enable = true } -> later text_document_lens req
| _ -> now [])
| TextDocumentHighlight req -> later highlight req
| DocumentSymbol { textDocument = { uri }; _ } -> later document_symbol uri
| TextDocumentDeclaration { textDocument = { uri }; position } ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ describe("textDocument/references", () => {

beforeEach(async () => {
languageServer = await LanguageServer.startAndInitialize();
languageServer.sendNotification("workspace/didChangeConfiguration", {
settings: {
codelens: { enable: true },
},
});
});

afterEach(async () => {
Expand Down

0 comments on commit 56838b1

Please sign in to comment.