Remove config option and read config file from ${workspace}/clice.toml (#258)
This commit is contained in:
@@ -5,14 +5,10 @@
|
||||
|
||||
# Supported variables:
|
||||
# - `${version}`: The version of clice.
|
||||
# - `${binary}`: The path of the clice binary.
|
||||
# - `${llvm_version}`: The LLVM version used by clice.
|
||||
# - `${workspace}`: The workspace directory provided by the client.
|
||||
|
||||
[server]
|
||||
# Compile commands directories to search for compile_commands.json files.
|
||||
compile_commands_dirs = ["${workspace}/build"]
|
||||
|
||||
[project]
|
||||
# Enable experimental clang-tidy diagnostics.
|
||||
# This feature is tracked in https://github.com/clice-project/clice/issues/90.
|
||||
clang_tidy = false
|
||||
@@ -22,22 +18,17 @@
|
||||
# The default value is 8. Whatever the number you set, the minimum is 1, the maximum is 512.
|
||||
max_active_file = 8
|
||||
|
||||
# Cache configuration for storing precompiled headers and modules.
|
||||
[cache]
|
||||
# Directory for storing PCH and PCM files.
|
||||
dir = "${workspace}/.clice/cache"
|
||||
cache_dir = "${workspace}/.clice/cache"
|
||||
|
||||
# Maximum number of cache files to keep. If the total exceeds this limit, clice
|
||||
# deletes the oldest files automatically. Set to 0 to disable the limit.
|
||||
limit = 0
|
||||
|
||||
# Index configuration for symbol and feature indexing.
|
||||
[index]
|
||||
# Directory for storing index files.
|
||||
dir = "${workspace}/.clice/index"
|
||||
index_dir = "${workspace}/.clice/index"
|
||||
|
||||
logging_dir = "${workspace}/.clice/logging"
|
||||
|
||||
# Compile commands directories to search for compile_commands.json files.
|
||||
compile_commands_dirs = ["${workspace}/build"]
|
||||
|
||||
# Whether to index entities in implicit template instantiations.
|
||||
implicitInstantiation = true
|
||||
|
||||
# Control the behavior for specific files. Note that Clice matches rules
|
||||
# in order. If you want to add your own rules, either delete this rule
|
||||
@@ -55,42 +46,10 @@
|
||||
# (e.g., `example.[0-9]` matches `example.0`, `example.1`, etc.).
|
||||
# - `[!...]`: Negates a range of characters to match in a path segment
|
||||
# (e.g., `example.[!0-9]` matches `example.a`, `example.b`, but not `example.0`).
|
||||
pattern = "**/*"
|
||||
patterns = ["**/*"]
|
||||
|
||||
# Commands to append to the original command list (e.g., ["-std=c++17"]).
|
||||
append = []
|
||||
|
||||
# Commands to remove from the original command list.
|
||||
remove = []
|
||||
|
||||
# Controls whether the file is treated as readonly.
|
||||
# Possible values: ["auto", "always", "never"]
|
||||
#
|
||||
# - "auto": Treats the file as readonly until you edit it.
|
||||
# - "always": Always treats the file as readonly.
|
||||
# - "never": Always treats the file as non-readonly.
|
||||
#
|
||||
# Readonly means the file is not editable, and LSP requests such as
|
||||
# code actions or completions will not be sent to the server. This avoids
|
||||
# dynamic computation and allows pre-indexed results to be loaded directly,
|
||||
# improving performance.
|
||||
readonly = "auto"
|
||||
|
||||
# Controls how header files are treated.
|
||||
# Possible values: ["auto", "always", "never"]
|
||||
#
|
||||
# - "auto": Attempts to infer the header context first. If no header context
|
||||
# is found, the file will be treated as a normal source file.
|
||||
# - "always": Always treats the file as a header file. If no header context
|
||||
# is found, errors will be reported.
|
||||
# - "never": Always treats the file as a source file.
|
||||
#
|
||||
# Header context refers to the related source files or additional metadata
|
||||
# linked to the header file.
|
||||
header = "auto"
|
||||
|
||||
# Specifies extra header contexts (file paths) for the file.
|
||||
# Normally, header contexts are inferred automatically once the file is indexed.
|
||||
# However, if you need immediate context before indexing completes, you can
|
||||
# provide it manually using this field.
|
||||
contexts = []
|
||||
|
||||
@@ -2,7 +2,21 @@
|
||||
|
||||
This is the documentation for `clice.toml`.
|
||||
|
||||
## Server
|
||||
## Project
|
||||
|
||||
| Name | Type | Default |
|
||||
| ------------------- | -------- | ----------------------------- |
|
||||
| `project.cache_dir` | `string` | `"${workspace}/.clice/cache"` |
|
||||
|
||||
Folder for storing PCH and PCM caches.
|
||||
<br>
|
||||
|
||||
| Name | Type | Default |
|
||||
| ------------------- | -------- | ----------------------------- |
|
||||
| `project.index_dir` | `string` | `"${workspace}/.clice/index"` |
|
||||
|
||||
Folder for storing index files.
|
||||
<br>
|
||||
|
||||
## Rule
|
||||
|
||||
@@ -11,7 +25,7 @@ This is the documentation for `clice.toml`.
|
||||
|
||||
| Name | Type |
|
||||
| ------------------ | ------------------- |
|
||||
| `[rules].pattern` | `array` of `string` |
|
||||
| `[rules].patterns` | `array` of `string` |
|
||||
|
||||
Glob patterns for matching file paths, following LSP's [standard](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentFilter).
|
||||
|
||||
@@ -23,70 +37,16 @@ Glob patterns for matching file paths, following LSP's [standard](https://micros
|
||||
- `[!...]`: Excludes a character range to match in a path segment (e.g., `example.[!0-9]` matches `example.a`, `example.b`, but not `example.0`).
|
||||
<br>
|
||||
|
||||
| Name | Type | Default |
|
||||
| ----------------- | ------------------- | ------- |
|
||||
| `[rules].append` | `array` of `string` | `[]` |
|
||||
| Name | Type | Default |
|
||||
| ---------------- | ------------------- | ------- |
|
||||
| `[rules].append` | `array` of `string` | `[]` |
|
||||
|
||||
Commands to append to the original command list. For example, `append = ["-std=c++17"]`.
|
||||
<br>
|
||||
|
||||
| Name | Type | Default |
|
||||
| ----------------- | ------------------- | ------- |
|
||||
| `[rules].remove` | `array` of `string` | `[]` |
|
||||
| Name | Type | Default |
|
||||
| ---------------- | ------------------- | ------- |
|
||||
| `[rules].remove` | `array` of `string` | `[]` |
|
||||
|
||||
Commands to remove from the original command list. For example, `remove = ["-std=c++11"]`.
|
||||
<br>
|
||||
|
||||
| Name | Type | Default |
|
||||
| ------------------- | -------- | ------- |
|
||||
| `[rules].readonly` | `string` | `"auto"` |
|
||||
|
||||
Controls whether the file is treated as read-only. Values can be one of `"auto"`, `"always"`, and `"never"`.
|
||||
|
||||
- `"auto"`: The file is treated as read-only before you edit it.
|
||||
- `"always"`: Always treat the file as read-only.
|
||||
- `"never"`: Always treat the file as non-read-only.
|
||||
|
||||
Read-only means the file is not editable, and LSP requests like code actions or completions won't be triggered on it. This avoids dynamic computation and allows direct loading of pre-indexed results, improving performance.
|
||||
<br>
|
||||
|
||||
| Name | Type | Default |
|
||||
| ----------------- | -------- | ------- |
|
||||
| `[rules].header` | `string` | `"auto"` |
|
||||
|
||||
Controls how to handle header files. Values can be one of `"auto"`, `"always"`, and `"never"`.
|
||||
|
||||
- `"auto"`: First try to infer header file context. If no header file context is found, the file will be treated as a regular source file.
|
||||
- `"always"`: Always treat the file as a header file. If no header file context is found, an error will be reported.
|
||||
- `"never"`: Always treat the file as a source file.
|
||||
|
||||
Header file context refers to the source files or other metadata associated with that header file.
|
||||
<br>
|
||||
|
||||
| Name | Type | Default |
|
||||
| -------------------- | ------------------- | ------- |
|
||||
| `[rules].contexts` | `array` of `string` | `[]` |
|
||||
|
||||
Specify additional header file contexts (file paths) for the file.
|
||||
|
||||
Usually, once a file is indexed, header file context is automatically inferred. However, if you need immediate context before indexing is complete, you can manually provide it using this field.
|
||||
|
||||
## Cache
|
||||
|
||||
| Name | Type | Default |
|
||||
| ----------- | -------- | ------------------------------ |
|
||||
| `cache.dir` | `string` | `"${workspace}/.clice/cache"` |
|
||||
|
||||
Folder for storing PCH and PCM caches.
|
||||
<br>
|
||||
|
||||
## Index
|
||||
|
||||
| Name | Type | Default |
|
||||
| ----------- | -------- | ------------------------------ |
|
||||
| `index.dir` | `string` | `"${workspace}/.clice/index"` |
|
||||
|
||||
Folder for storing index files.
|
||||
<br>
|
||||
|
||||
## Feature
|
||||
|
||||
@@ -2,16 +2,30 @@
|
||||
|
||||
这是 `clice.toml` 的文档。
|
||||
|
||||
## Server
|
||||
## Project
|
||||
|
||||
| 名称 | 类型 | 默认值 |
|
||||
| ------------------- | -------- | ----------------------------- |
|
||||
| `project.cache_dir` | `string` | `"${workspace}/.clice/cache"` |
|
||||
|
||||
用于储存 PCH 和 PCM 缓存的文件夹。
|
||||
<br>
|
||||
|
||||
| 名称 | 类型 | 默认值 |
|
||||
| ------------------- | -------- | ----------------------------- |
|
||||
| `project.index_dir` | `string` | `"${workspace}/.clice/index"` |
|
||||
|
||||
用于储存索引文件的文件夹。
|
||||
<br>
|
||||
|
||||
## Rule
|
||||
|
||||
`[[rules]]` 表示一个对象数组,其中每个对象都拥有下面这些属性
|
||||
<br>
|
||||
|
||||
| 名称 | 类型 |
|
||||
| ----------------- | ------------------- |
|
||||
| `[rules].pattern` | `array` of `string` |
|
||||
| 名称 | 类型 |
|
||||
| ------------------ | ------------------- |
|
||||
| `[rules].patterns` | `array` of `string` |
|
||||
|
||||
用于匹配文件路径的 glob patterns,遵循 LSP 的 [标准](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentFilter)。
|
||||
|
||||
@@ -23,70 +37,16 @@
|
||||
- `[!...]`: 排除要匹配的路径段中的字符范围 (例如,`example.[!0-9]` 匹配 `example.a`, `example.b`,但不匹配 `example.0`)。
|
||||
<br>
|
||||
|
||||
| 名称 | 类型 | 默认值 |
|
||||
| ---------------- | ------------------- | ------- |
|
||||
| `[rules].append` | `array` of `string` | `[]` |
|
||||
| 名称 | 类型 | 默认值 |
|
||||
| ---------------- | ------------------- | ------ |
|
||||
| `[rules].append` | `array` of `string` | `[]` |
|
||||
|
||||
追加到原始命令列表中的命令。例如,`append = ["-std=c++17"]`。
|
||||
<br>
|
||||
|
||||
| 名称 | 类型 | 默认值 |
|
||||
| ---------------- | ------------------- | ------- |
|
||||
| `[rules].remove` | `array` of `string` | `[]` |
|
||||
| 名称 | 类型 | 默认值 |
|
||||
| ---------------- | ------------------- | ------ |
|
||||
| `[rules].remove` | `array` of `string` | `[]` |
|
||||
|
||||
从原始命令列表中移除的命令。例如,`remove = ["-std=c++11"]`。
|
||||
<br>
|
||||
|
||||
| 名称 | 类型 | 默认值 |
|
||||
| ------------------ | -------- | -------- |
|
||||
| `[rules].readonly` | `string` | `"auto"` |
|
||||
|
||||
控制文件是否被视为只读。值可以是 `"auto"`、`"always"` 和 `"never"` 中的一个。
|
||||
|
||||
- `"auto"`: 在你编辑文件之前,文件被视为只读。
|
||||
- `"always"`: 始终将文件视为只读。
|
||||
- `"never"`: 始终将文件视为非只读。
|
||||
|
||||
只读意味着文件不可编辑,并且像代码操作 (code actions) 或补全 (completions) 这样的 LSP 请求不会在其上触发。这避免了动态计算,并允许直接加载预先索引的结果,从而提高性能。
|
||||
<br>
|
||||
|
||||
| 名称 | 类型 | 默认值 |
|
||||
| ---------------- | -------- | -------- |
|
||||
| `[rules].header` | `string` | `"auto"` |
|
||||
|
||||
控制如何处理头文件。值可以是 `"auto"`、`"always"` 和 `"never"` 中的一个。
|
||||
|
||||
- `"auto"`: 首先尝试推断头文件上下文。如果未找到头文件上下文,文件将被视为普通的源文件。
|
||||
- `"always"`: 始终将文件视为头文件。如果未找到头文件上下文,将会报告错误。
|
||||
- `"never"`: 始终将文件视为源文件。
|
||||
|
||||
头文件上下文指的是与该头文件相关联的源文件或其他元数据。
|
||||
<br>
|
||||
|
||||
| 名称 | 类型 | 默认值 |
|
||||
| ------------------ | ------------------- | ------- |
|
||||
| `[rules].contexts` | `array` of `string` | `[]` |
|
||||
|
||||
为文件指定额外的头文件上下文 (文件路径)。
|
||||
|
||||
通常,一旦文件被索引,头文件上下文会自动推断。但是,如果你需要在索引完成前获得即时上下文,可以使用此字段手动提供。
|
||||
|
||||
## Cache
|
||||
|
||||
| 名称 | 类型 | 默认值 |
|
||||
| ----------- | -------- | ----------------------------- |
|
||||
| `cache.dir` | `string` | `"${workspace}/.clice/cache"` |
|
||||
|
||||
用于储存 PCH 和 PCM 缓存的文件夹。
|
||||
<br>
|
||||
|
||||
## Index
|
||||
|
||||
| 名称 | 类型 | 默认值 |
|
||||
| ----------- | -------- | ----------------------------- |
|
||||
| `index.dir` | `string` | `"${workspace}/.clice/index"` |
|
||||
|
||||
用于储存索引文件的文件夹。
|
||||
<br>
|
||||
|
||||
## Feature
|
||||
|
||||
Reference in New Issue
Block a user