diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2023-07-02 00:01:00 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2023-07-02 00:01:00 +0200 |
| commit | 4a472b88d51807eb3cd58b01c0037443bf8a4404 (patch) | |
| tree | 9f9a0312df3546f84470477fbbddda5ffa5fe7f0 /src/server | |
| parent | 40f992f4f051e343331f44aa4c791e6f6abc8426 (diff) | |
Add new setting to enable fake methods for testing
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/collector.odin | 4 | ||||
| -rw-r--r-- | src/server/completion.odin | 4 | ||||
| -rw-r--r-- | src/server/requests.odin | 15 | ||||
| -rw-r--r-- | src/server/types.odin | 4 |
4 files changed, 21 insertions, 6 deletions
diff --git a/src/server/collector.odin b/src/server/collector.odin index 1b9e72f..21c6a52 100644 --- a/src/server/collector.odin +++ b/src/server/collector.odin @@ -789,8 +789,8 @@ collect_symbols :: proc( collect_objc(collection, expr.attributes, symbol) } - if symbol.type == .Function { - //collect_method(collection, symbol) + if symbol.type == .Function && common.config.enable_fake_method { + collect_method(collection, symbol) } if v, ok := pkg.symbols[symbol.name]; !ok || v.name == "" { diff --git a/src/server/completion.odin b/src/server/completion.odin index 10a1583..ff37211 100644 --- a/src/server/completion.odin +++ b/src/server/completion.odin @@ -334,7 +334,9 @@ get_selector_completion :: proc( } } - //append_method_completion(ast_context, selector, &items) + if common.config.enable_fake_method { + append_method_completion(ast_context, selector, &items) + } #partial switch v in selector.value { case SymbolFixedArrayValue: diff --git a/src/server/requests.odin b/src/server/requests.odin index 4b5c6de..14828d2 100644 --- a/src/server/requests.odin +++ b/src/server/requests.odin @@ -432,6 +432,8 @@ read_ols_initialize_options :: proc( ) config.enable_inlay_hints = ols_config.enable_inlay_hints.(bool) or_else config.enable_inlay_hints + config.enable_fake_method = + ols_config.enable_fake_methods.(bool) or_else config.enable_fake_method // copy collections from new config when ODIN_OS == .Windows { @@ -440,11 +442,17 @@ read_ols_initialize_options :: proc( common.get_case_sensitive_path(it.path), context.temp_allocator, ) - config.collections[it.name] = strings.clone(forward, context.allocator) + config.collections[it.name] = strings.clone( + forward, + context.allocator, + ) } } else { for it in ols_config.collections { - config.collections[it.name] = strings.clone(it.path, context.allocator) + config.collections[it.name] = strings.clone( + it.path, + context.allocator, + ) } } @@ -551,8 +559,11 @@ request_initialize :: proc( ) config.enable_inlay_hints = ols_config.enable_inlay_hints.(bool) or_else false + config.enable_fake_method = + ols_config.enable_fake_methods.(bool) or_else false config.enable_format = true + for p in ols_config.collections { forward_path, _ := filepath.to_slash( p.path, diff --git a/src/server/types.odin b/src/server/types.odin index 244183d..33e63a6 100644 --- a/src/server/types.odin +++ b/src/server/types.odin @@ -340,6 +340,7 @@ OlsConfig :: struct { enable_snippets: Maybe(bool), enable_inlay_hints: Maybe(bool), enable_references: Maybe(bool), + enable_fake_methods: Maybe(bool), disable_parser_errors: Maybe(bool), verbose: Maybe(bool), file_log: Maybe(bool), @@ -487,4 +488,5 @@ WorkspaceSymbol :: struct { DidChangeConfigurationParams :: struct { settings: OlsConfig, -}
\ No newline at end of file +} + |