diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2023-06-26 13:54:40 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2023-06-26 13:54:40 +0200 |
| commit | 9120feed29abfda747dd8130d9d30d1e4145f58d (patch) | |
| tree | a74bff51b2bc8807a9feb244dcff26f3972f557d /src/server | |
| parent | df856c55a336dc7e425671eb96568f791e8c079b (diff) | |
Fixed issue with collections and being correct on change config
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/requests.odin | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/src/server/requests.odin b/src/server/requests.odin index 6cbcb2c..3804e51 100644 --- a/src/server/requests.odin +++ b/src/server/requests.odin @@ -432,6 +432,47 @@ read_ols_initialize_options :: proc( ) config.enable_inlay_hints = ols_config.enable_inlay_hints.(bool) or_else config.enable_inlay_hints + + + odin_core_env := os.get_env("ODIN_ROOT", context.temp_allocator) + + if odin_core_env == "" { + if exe_path, ok := common.lookup_in_path("odin"); ok { + odin_core_env = filepath.dir(exe_path, context.temp_allocator) + } + } + + if "core" not_in config.collections && odin_core_env != "" { + forward_path, _ := filepath.to_slash( + odin_core_env, + context.temp_allocator, + ) + config.collections["core"] = path.join( + elems = {forward_path, "core"}, + allocator = context.allocator, + ) + } + + if "vendor" not_in config.collections && odin_core_env != "" { + forward_path, _ := filepath.to_slash( + odin_core_env, + context.temp_allocator, + ) + config.collections["vendor"] = path.join( + elems = {forward_path, "vendor"}, + allocator = context.allocator, + ) + } + + when ODIN_OS == .Windows { + for k, v in config.collections { + forward, _ := filepath.to_slash( + common.get_case_sensitive_path(v), + context.temp_allocator, + ) + config.collections[k] = strings.clone(forward, context.allocator) + } + } } request_initialize :: proc( @@ -574,46 +615,6 @@ request_initialize :: proc( initialize_params.initializationOptions, ) - odin_core_env := os.get_env("ODIN_ROOT", context.temp_allocator) - - if odin_core_env == "" { - if exe_path, ok := common.lookup_in_path("odin"); ok { - odin_core_env = filepath.dir(exe_path, context.temp_allocator) - } - } - - if "core" not_in config.collections && odin_core_env != "" { - forward_path, _ := filepath.to_slash( - odin_core_env, - context.temp_allocator, - ) - config.collections["core"] = path.join( - elems = {forward_path, "core"}, - allocator = context.allocator, - ) - } - - if "vendor" not_in config.collections && odin_core_env != "" { - forward_path, _ := filepath.to_slash( - odin_core_env, - context.temp_allocator, - ) - config.collections["vendor"] = path.join( - elems = {forward_path, "vendor"}, - allocator = context.allocator, - ) - } - - when ODIN_OS == .Windows { - for k, v in config.collections { - forward, _ := filepath.to_slash( - common.get_case_sensitive_path(v), - context.temp_allocator, - ) - config.collections[k] = strings.clone(forward, context.allocator) - } - } - for format in initialize_params.capabilities.textDocument.hover.contentFormat { if format == "markdown" { config.hover_support_md = true |