diff options
| author | Bradley Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-26 10:30:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-26 10:30:15 -0400 |
| commit | 5782a7aa19e2bc95450bb0099407f38407e8bc2d (patch) | |
| tree | 5254890d82c96acb369d17006467b38af8e16b04 | |
| parent | dcf0ee2a22e655fe918f58f13eefb6cf240baecc (diff) | |
| parent | 74ea70325e4daca321a0932828f236ea8c77f2ec (diff) | |
Merge pull request #934 from BradLewis/feat/add-option-disable-document-links
Add option to disable document links
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | builtin/builtin.odin | 2 | ||||
| -rw-r--r-- | misc/ols.schema.json | 5 | ||||
| -rw-r--r-- | odinfmt.json | 2 | ||||
| -rwxr-xr-x | odinfmt.sh | 2 | ||||
| -rw-r--r-- | src/common/config.odin | 1 | ||||
| -rw-r--r-- | src/server/requests.odin | 10 | ||||
| -rw-r--r-- | src/server/types.odin | 1 |
8 files changed, 22 insertions, 3 deletions
@@ -90,6 +90,8 @@ Options: `enable_completion_matching`: Attempt to match types and pointers when passing arguments to procedures. _(Enabled by default)_ +`enable_document_links`: Follow links when opening documentation. This is usually done via `<ctrl+click>` and will open the documentation in a browser (or similar). _(Enabled by default)_ + `odin_command`: Specify the location to your Odin executable, rather than relying on the environment path. `odin_root_override`: Allows you to specify a custom `ODIN_ROOT` that `ols` will use to look for `odin` core libraries when implementing custom runtimes. diff --git a/builtin/builtin.odin b/builtin/builtin.odin index e13b6fd..f342ff9 100644 --- a/builtin/builtin.odin +++ b/builtin/builtin.odin @@ -351,7 +351,7 @@ ODIN_VERSION: string Empty if `.git` could not be detected at the time the compiler was built. */ @builtin -ODIN_VERSION_HASH:string +ODIN_VERSION_HASH: string @builtin Odin_Windows_Subsystem_Type :: enum int { diff --git a/misc/ols.schema.json b/misc/ols.schema.json index 3ec252d..3bd2489 100644 --- a/misc/ols.schema.json +++ b/misc/ols.schema.json @@ -80,6 +80,11 @@ "description": "Turn on fake methods completion.", "default": false }, + "enable_document_links": { + "type": "boolean", + "description": "Follow links when opening documentation.", + "default": true + }, "disable_parser_errors": { "type": "boolean" }, "verbose": { "type": "boolean", diff --git a/odinfmt.json b/odinfmt.json index d3f7daa..6910b06 100644 --- a/odinfmt.json +++ b/odinfmt.json @@ -2,4 +2,4 @@ "character_width": 120, "tabs": true, "tabs_width": 4 -}
\ No newline at end of file +} @@ -1,3 +1,3 @@ #!/usr/bin/env bash -odin build tools/odinfmt/main.odin -file -show-timings -collection:src=src -out:odinfmt -o:speed +odin build tools/odinfmt/main.odin -file -show-timings -collection:src=src -out:odinfmt -o:none diff --git a/src/common/config.odin b/src/common/config.odin index e45e2b6..5b2923c 100644 --- a/src/common/config.odin +++ b/src/common/config.odin @@ -35,6 +35,7 @@ Config :: struct { enable_checker_only_saved: bool, enable_auto_import: bool, enable_completion_matching: bool, + enable_document_links: bool, disable_parser_errors: bool, thread_count: int, file_log: bool, diff --git a/src/server/requests.odin b/src/server/requests.odin index c564a31..4f090d8 100644 --- a/src/server/requests.odin +++ b/src/server/requests.odin @@ -367,6 +367,7 @@ read_ols_initialize_options :: proc(config: ^common.Config, ols_config: OlsConfi config.enable_references = ols_config.enable_references.(bool) or_else config.enable_references config.enable_completion_matching = ols_config.enable_completion_matching.(bool) or_else config.enable_completion_matching + config.enable_document_links = ols_config.enable_document_links.(bool) or_else config.enable_document_links config.verbose = ols_config.verbose.(bool) or_else config.verbose config.file_log = ols_config.file_log.(bool) or_else config.file_log @@ -615,6 +616,7 @@ request_initialize :: proc( config.enable_snippets = false config.enable_references = true config.enable_completion_matching = true + config.enable_document_links = true config.verbose = false config.file_log = false config.odin_command = "" @@ -1335,6 +1337,14 @@ request_document_links :: proc( config: ^common.Config, writer: ^Writer, ) -> common.Error { + if !config.enable_document_links { + links: []DocumentLink + response := make_response_message(params = links, id = id) + + send_response(response, writer) + return .None + } + params_object, ok := params.(json.Object) if !ok { diff --git a/src/server/types.odin b/src/server/types.odin index 4795f11..e13ae31 100644 --- a/src/server/types.odin +++ b/src/server/types.odin @@ -413,6 +413,7 @@ OlsConfig :: struct { enable_inlay_hints_params: Maybe(bool), enable_inlay_hints_default_params: Maybe(bool), enable_references: Maybe(bool), + enable_document_links: Maybe(bool), enable_fake_methods: Maybe(bool), enable_procedure_snippet: Maybe(bool), enable_checker_only_saved: Maybe(bool), |