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

feature: disable code lens by default #1134

Merged
merged 1 commit into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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. (#1134)

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

Expand Down
10 changes: 7 additions & 3 deletions ocaml-lsp-server/docs/ocamllsp/config.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# Configuration

The ocamllsp support the folowing configuration. These configurations are sent through the [`didChangeConfiguration`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didChangeConfiguration) notification.
The ocamllsp support the folowing configurations.

These configurations are sent through the
[`didChangeConfiguration`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didChangeConfiguration)
notification.

```ts
interface config {
/**
* Enable/Disabe Extended Hover
* Enable/Disable Extended Hover
* @default false
* @since 1.16
*/
extendedHover: { enable : boolean }

/**
* Enable/Disable CodeLens
* @default true
* @default false
* @since 1.16
*/
codelens: { enable : boolean }
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