diff --git a/LSP-clangd.sublime-settings b/LSP-clangd.sublime-settings index f0ef084..407510f 100644 --- a/LSP-clangd.sublime-settings +++ b/LSP-clangd.sublime-settings @@ -49,14 +49,14 @@ // If set to true, code completion will include index symbols that are not defined in the scopes (e.g. namespaces) visible from the code completion point. // Such completions can insert scope qualifiers - "clangd.all-scopes-completion": false, + "clangd.all-scopes-completion": null, // Index project code in the background and persist index on disk - "clangd.background-index": false, + "clangd.background-index": null, // Thread priority for building the background index. The effect of this flag is OS-specific. // One of "background", "low", "normal" "clangd.background-index-priority": null, // Enable clang-tidy diagnostics - "clangd.clang-tidy": false, + "clangd.clang-tidy": null, // Granularity of code completion suggestions // detailed: One completion item for each semantically distinct completion, with full type information // bundled: Similar completion items (e.g. function overloads) are combined. Type information shown where possible @@ -65,13 +65,13 @@ "clangd.fallback-style": null, // When disabled, completions contain only parentheses for function calls. // When enabled, completions also contain placeholders for method parameters - "clangd.function-arg-placeholders": false, + "clangd.function-arg-placeholders": null, // Add #include directives when accepting code completions // iwyu: Include what you use. Insert the owning header for top-level symbols, unless the header is already directly included or the symbol is forward-declared // never: Never insert #include directives as part of code completion "clangd.header-insertion": null, // Prepend a circular dot or space before the completion label, depending on whether an include line will be inserted or not - "clangd.header-insertion-decorators": false, + "clangd.header-insertion-decorators": null, // Limit the number of references returned by clangd. 0 means no limit (default=1000) "clangd.limit-references": null, // Limit the number of results returned by clangd. 0 means no limit (default=100) @@ -86,11 +86,11 @@ // Number of workers used for indexing and language server "clangd.number-workers": null, // Set to "true" to release memory periodically via malloc_trim(3) - "clangd.malloc-trim": false, + "clangd.malloc-trim": null, // One of "disk", "memory". Storing PCHs in memory increases memory usages, but may improve performance "clangd.pch-storage": null, // Read user and project configuration from YAML files. - "clangd.enable-config": false, + "clangd.enable-config": null, // clangd protocol and logging options: @@ -100,6 +100,6 @@ // Comma separated list of '=' pairs, the first entry matching a given path is used. e.g. /home/project/incl=/opt/include,/home/project=/workarea/project "clangd.path-mappings": null, // Pretty-print JSON output - "clangd.pretty": false, + "clangd.pretty": null, }, } diff --git a/plugin.py b/plugin.py index 9ccadce..fd2b681 100644 --- a/plugin.py +++ b/plugin.py @@ -180,12 +180,13 @@ def on_pre_start( configuration.command = clangd_base_command.copy() for key, value in configuration.init_options.get("clangd").items(): - if not value: - # False or None - continue - elif value is True: - configuration.command.append(get_argument_for_setting(key)) - elif isinstance(value, str) or isinstance(value, int): + if value is None: + continue # Use clangd default + + if isinstance(value, bool): + value = str(value).lower() + + if isinstance(value, str) or isinstance(value, int): configuration.command.append("{key}={value}".format(key=get_argument_for_setting(key), value=value)) else: raise TypeError("Type {} not supported for setting {}.".format(str(type(value)), key)) diff --git a/sublime-package.json b/sublime-package.json index 5ce6c97..16d72ed 100644 --- a/sublime-package.json +++ b/sublime-package.json @@ -70,11 +70,19 @@ "description": "Comma separated list of globs for white-listing gcc-compatible drivers that are safe to execute." }, "clangd.all-scopes-completion": { - "type": "boolean", + "type": [ + "boolean", + "null" + ], + "default": null, "description": "If set to true, code completion will include index symbols that are not defined in the scopes (e.g. namespaces) visible from the code completion point." }, "clangd.background-index": { - "type": "boolean", + "type": [ + "boolean", + "null" + ], + "default": null, "description": "Index project code in the background and persist index on disk." }, "clangd.background-index-priority": { @@ -92,7 +100,11 @@ ] }, "clangd.clang-tidy": { - "type": "boolean", + "type": [ + "boolean", + "null" + ], + "default": null, "description": "Enable clang-tidy diagnostics." }, "clangd.completion-style": { @@ -122,12 +134,18 @@ "description": "clang-format style to apply by default when no .clang-format file is found" }, "clangd.function-arg-placeholders": { - "type": "boolean", + "type": [ + "boolean", + "null" + ], + "default": null, "enum": [ + null, true, false ], "enumDescriptions": [ + "use clangd default", "completions also contain placeholders for method parameters", "completions contain only parentheses for function calls" ] @@ -150,7 +168,11 @@ ] }, "clangd.header-insertion-decorators": { - "type": "boolean", + "type": [ + "boolean", + "null" + ], + "default": null, "description": "Prepend a circular dot or space before the completion label, depending on whether an include line will be inserted or not" }, "clangd.limit-references": { @@ -196,7 +218,11 @@ "description": "Number of workers used for indexing and language server" }, "clangd.malloc-trim": { - "type": "boolean", + "type": [ + "boolean", + "null" + ], + "default": null, "description": "Release memory periodically via malloc_trim(3)" }, "clangd.pch-storage": { @@ -213,7 +239,11 @@ ] }, "clangd.enable-config": { - "type": "boolean", + "type": [ + "boolean", + "null" + ], + "default": null, "description": "Read user and project configuration from YAML files." }, "clangd.log": { @@ -239,7 +269,11 @@ "description": "Translates between client paths (as seen by a remote editor) and server paths (where clangd sees files on disk)." }, "clangd.pretty": { - "type": "boolean", + "type": [ + "boolean", + "null" + ], + "default": null, "description": "Pretty-print JSON output" } },