Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 90 additions & 49 deletions crates/emmylua_code_analysis/resources/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
},
"codeLens": {
"$ref": "#/$defs/EmmyrcCodeLen",
"$ref": "#/$defs/EmmyrcCodeLens",
"default": {
"enable": true
}
Expand Down Expand Up @@ -438,19 +438,21 @@
"type": "object",
"properties": {
"insertSpace": {
"description": "Whether to insert space after '---'",
"description": "Add space after `---` comments when inserting `@diagnostic disable-next-line`.",
"type": "boolean",
"default": false
"default": false,
"x-vscode-setting": true
}
}
},
"EmmyrcCodeLen": {
"EmmyrcCodeLens": {
"type": "object",
"properties": {
"enable": {
"description": "Whether to enable code lens.",
"description": "Enable code lens.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
}
}
},
Expand All @@ -459,9 +461,10 @@
"type": "object",
"properties": {
"autoRequire": {
"description": "Whether to automatically require modules.",
"description": "Automatically insert call to `require` when autocompletion\ninserts objects from other modules.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
},
"autoRequireFunction": {
"description": "The function used for auto-requiring modules.",
Expand All @@ -479,24 +482,45 @@
"default": "."
},
"baseFunctionIncludesName": {
"description": "Whether to include the name in the base function completion. effect: `function () end` -> `function name() end`.",
"description": "Whether to include the name in the base function completion. Effect: `function () end` -> `function name() end`.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
},
"callSnippet": {
"description": "Whether to use call snippets in completions.",
"type": "boolean",
"default": false
},
"enable": {
"description": "Whether to enable code completion.",
"description": "Enable autocompletion.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
},
"postfix": {
"description": "The postfix trigger used in completions.",
"type": "string",
"default": "@"
"description": "Symbol that's used to trigger postfix autocompletion.",
"type": "string",
"default": "@",
"x-vscode-setting": {
"default": null,
"enum": [
null,
"@",
".",
":"
],
"enumItemLabels": [
"Default"
],
"markdownEnumDescriptions": [
"%config.common.enum.default.description%"
],
"type": [
"string",
"null"
]
}
}
}
},
Expand All @@ -505,13 +529,14 @@
"type": "object",
"properties": {
"diagnosticInterval": {
"description": "The interval in milliseconds to perform diagnostics.",
"description": "Delay between opening/changing a file and scanning it for errors, in milliseconds.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0
"minimum": 0,
"x-vscode-setting": true
},
"disable": {
"description": "A list of diagnostic codes that are disabled.",
Expand Down Expand Up @@ -585,9 +610,10 @@
"type": "object",
"properties": {
"enable": {
"description": "Whether to enable document color.",
"description": "Enable parsing strings for color tags and showing a color picker next to them.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
}
}
},
Expand Down Expand Up @@ -624,59 +650,68 @@
"type": "object",
"properties": {
"enable": {
"description": "Whether to enable hover.",
"description": "Enable showing documentation on hover.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
}
}
},
"EmmyrcInlayHint": {
"type": "object",
"properties": {
"enable": {
"description": "Whether to enable inlay hints.",
"description": "Enable inlay hints.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
},
"enumParamHint": {
"description": "Whether to enable enum parameter hints.",
"description": "Show name of enumerator when passing a literal value to a function\nthat expects an enum.\n\nExample:\n\n```lua\n--- @enum Level\nlocal Foo = {\n Info = 1,\n Error = 2,\n}\n\n--- @param l Level\nfunction print_level(l) end\n\nprint_level(1 --[[ Hint: Level.Info ]])\n```",
"type": "boolean",
"default": false
"default": false,
"x-vscode-setting": true
},
"indexHint": {
"description": "Whether to enable index hints.",
"description": "Show named array indexes.\n\nExample:\n\n```lua\nlocal array = {\n [1] = 1, -- [name]\n}\n\nprint(array[1] --[[ Hint: name ]])\n```",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
},
"localHint": {
"description": "Whether to enable local hints.\nWhether to enable override hints.",
"description": "Show types of local variables.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
},
"metaCallHint": {
"description": "Whether to enable meta __call operator hints.",
"description": "Show hint when calling an object results in a call to\nits meta table's `__call` function.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
},
"overrideHint": {
"description": "Whether to enable override hints.",
"description": "Show methods that override functions from base class.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
},
"paramHint": {
"description": "Whether to enable parameter hints.",
"description": "Show parameter names in function calls and parameter types in function definitions.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
}
}
},
"EmmyrcInlineValues": {
"type": "object",
"properties": {
"enable": {
"description": "Whether to enable inline values.",
"description": "Show inline values during debug.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
}
}
},
Expand Down Expand Up @@ -723,19 +758,22 @@
"type": "object",
"properties": {
"enable": {
"description": "Whether to enable reference search.",
"description": "Enable searching for symbol usages.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
},
"fuzzySearch": {
"description": "Determines whether to enable fuzzy searching for fields where references cannot be found.",
"description": "Use fuzzy search when searching for symbol usages\nand normal search didn't find anything.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
},
"shortStringSearch": {
"description": "Cache Short string for search",
"description": "Also search for usages in strings.",
"type": "boolean",
"default": false
"default": false,
"x-vscode-setting": true
}
}
},
Expand Down Expand Up @@ -806,9 +844,10 @@
"type": "object",
"properties": {
"enable": {
"description": "Whether to enable semantic token.",
"description": "Enable semantic tokens.",
"type": "boolean",
"default": true
"default": true,
"x-vscode-setting": true
}
}
},
Expand Down Expand Up @@ -855,9 +894,10 @@
"type": "object",
"properties": {
"enableReindex": {
"description": "Enable reindex.",
"description": "Enable full project reindex after changing a file.",
"type": "boolean",
"default": false
"default": false,
"x-vscode-setting": true
},
"encoding": {
"description": "Encoding. eg: \"utf-8\"",
Expand Down Expand Up @@ -902,11 +942,12 @@
"default": 0
},
"reindexDuration": {
"description": "when save a file, ls will reindex the workspace after reindex_duration milliseconds.",
"description": "Delay between changing a file and full project reindex, in milliseconds.",
"type": "integer",
"format": "uint64",
"default": 5000,
"minimum": 0
"minimum": 0,
"x-vscode-setting": true
},
"workspaceRoots": {
"description": "Workspace roots. eg: [\"src\", \"test\"]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
#[serde(rename_all = "camelCase")]
pub struct EmmyrcCodeAction {
/// Whether to insert space after '---'
/// Add space after `---` comments when inserting `@diagnostic disable-next-line`.
#[serde(default = "default_false")]
#[schemars(extend("x-vscode-setting" = true))]
pub insert_space: bool,
}

Expand Down
7 changes: 4 additions & 3 deletions crates/emmylua_code_analysis/src/config/configs/codelen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
#[serde(rename_all = "camelCase")]
pub struct EmmyrcCodeLen {
/// Whether to enable code lens.
pub struct EmmyrcCodeLens {
/// Enable code lens.
#[serde(default = "default_true")]
#[schemars(extend("x-vscode-setting" = true))]
pub enable: bool,
}

impl Default for EmmyrcCodeLen {
impl Default for EmmyrcCodeLens {
fn default() -> Self {
Self {
enable: default_true(),
Expand Down
19 changes: 15 additions & 4 deletions crates/emmylua_code_analysis/src/config/configs/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ use serde_with::{DefaultOnError, serde_as};
#[serde(rename_all = "camelCase")]
/// Configuration for EmmyLua code completion.
pub struct EmmyrcCompletion {
/// Whether to enable code completion.
/// Enable autocompletion.
#[serde(default = "default_true")]
#[schemars(extend("x-vscode-setting" = true))]
pub enable: bool,
/// Whether to automatically require modules.
/// Automatically insert call to `require` when autocompletion
/// inserts objects from other modules.
#[serde(default = "default_true")]
#[schemars(extend("x-vscode-setting" = true))]
pub auto_require: bool,
/// The function used for auto-requiring modules.
#[serde(default = "default_require_function")]
Expand All @@ -26,11 +29,19 @@ pub struct EmmyrcCompletion {
#[serde(default)]
#[serde_as(deserialize_as = "DefaultOnError")]
pub call_snippet: bool,
/// The postfix trigger used in completions.
/// Symbol that's used to trigger postfix autocompletion.
#[serde(default = "default_postfix")]
#[schemars(extend("x-vscode-setting" = {
"type": ["string", "null"],
"default": null,
"enum": [null, "@", ".", ":"],
"enumItemLabels": ["Default"],
"markdownEnumDescriptions": ["%config.common.enum.default.description%"],
}))]
pub postfix: String,
/// Whether to include the name in the base function completion. effect: `function () end` -> `function name() end`.
/// Whether to include the name in the base function completion. Effect: `function () end` -> `function name() end`.
#[serde(default = "default_true")]
#[schemars(extend("x-vscode-setting" = true))]
pub base_function_includes_name: bool,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ pub struct EmmyrcDiagnostic {
/// A list of diagnostic codes that are enabled.
#[serde(default)]
pub enables: Vec<DiagnosticCode>,
/// The interval in milliseconds to perform diagnostics.
/// Delay between opening/changing a file and scanning it for errors, in milliseconds.
#[schemars(extend("x-vscode-setting" = true))]
pub diagnostic_interval: Option<u64>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
#[serde(rename_all = "camelCase")]
pub struct EmmyrcDocumentColor {
/// Whether to enable document color.
/// Enable parsing strings for color tags and showing a color picker next to them.
#[serde(default = "default_true")]
#[schemars(extend("x-vscode-setting" = true))]
pub enable: bool,
}

Expand Down
3 changes: 2 additions & 1 deletion crates/emmylua_code_analysis/src/config/configs/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
#[serde(rename_all = "camelCase")]
pub struct EmmyrcHover {
/// Whether to enable hover.
/// Enable showing documentation on hover.
#[serde(default = "default_true")]
#[schemars(extend("x-vscode-setting" = true))]
pub enable: bool,
}

Expand Down
Loading
Loading