diff options
-rw-r--r-- | changelog.md | 2 | ||||
-rw-r--r-- | doc/en-us/config.md | 73 | ||||
-rw-r--r-- | doc/pt-br/config.md | 73 | ||||
-rw-r--r-- | doc/zh-cn/config.md | 73 | ||||
-rw-r--r-- | doc/zh-tw/config.md | 73 | ||||
-rw-r--r-- | script/config/template.lua | 27 | ||||
-rw-r--r-- | script/proto/define.lua | 4 | ||||
-rw-r--r-- | script/proto/diagnostic.lua | 16 |
8 files changed, 339 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md index a1608bd0..abb50919 100644 --- a/changelog.md +++ b/changelog.md @@ -23,7 +23,7 @@ local n2 = f(0) -- `n2` is `number` local n3 = f(0, 0) -- `n3` is `string` ``` -* `CHG` improve speed for diagnostics and semantic-tokens +* `CHG` improve experience for diagnostics and semantic-tokens * `FIX` diagnostics flash when opening a file * `FIX` sometimes workspace diagnostics are not triggered * `FIX` [#1228](https://github.com/sumneko/lua-language-server/issues/1228) diff --git a/doc/en-us/config.md b/doc/en-us/config.md index 731eb679..cd085d84 100644 --- a/doc/en-us/config.md +++ b/doc/en-us/config.md @@ -240,6 +240,79 @@ Array<string> [] ``` +# diagnostics.groupFileStatus + +**Missing description!!** + +## type + +```ts +object<string, string> +``` + +## enum + +* ``"Any"`` +* ``"Opened"`` +* ``"None"`` +* ``"Fallback"`` + +## default + +```json +{ + "ambiguity": "Fallback", + "await": "Fallback", + "codestyle": "Fallback", + "duplicate": "Fallback", + "global": "Fallback", + "luadoc": "Fallback", + "no-unknown": "Fallback", + "redefined": "Fallback", + "strict": "Fallback", + "type-check": "Fallback", + "unbalanced": "Fallback", + "unused": "Fallback" +} +``` + +# diagnostics.groupSeverity + +**Missing description!!** + +## type + +```ts +object<string, string> +``` + +## enum + +* ``"Error"`` +* ``"Warning"`` +* ``"Information"`` +* ``"Hint"`` +* ``"Fallback"`` + +## default + +```json +{ + "ambiguity": "Fallback", + "await": "Fallback", + "codestyle": "Fallback", + "duplicate": "Fallback", + "global": "Fallback", + "luadoc": "Fallback", + "no-unknown": "Fallback", + "redefined": "Fallback", + "strict": "Fallback", + "type-check": "Fallback", + "unbalanced": "Fallback", + "unused": "Fallback" +} +``` + # diagnostics.ignoredFiles How to diagnose ignored files. diff --git a/doc/pt-br/config.md b/doc/pt-br/config.md index 731eb679..cd085d84 100644 --- a/doc/pt-br/config.md +++ b/doc/pt-br/config.md @@ -240,6 +240,79 @@ Array<string> [] ``` +# diagnostics.groupFileStatus + +**Missing description!!** + +## type + +```ts +object<string, string> +``` + +## enum + +* ``"Any"`` +* ``"Opened"`` +* ``"None"`` +* ``"Fallback"`` + +## default + +```json +{ + "ambiguity": "Fallback", + "await": "Fallback", + "codestyle": "Fallback", + "duplicate": "Fallback", + "global": "Fallback", + "luadoc": "Fallback", + "no-unknown": "Fallback", + "redefined": "Fallback", + "strict": "Fallback", + "type-check": "Fallback", + "unbalanced": "Fallback", + "unused": "Fallback" +} +``` + +# diagnostics.groupSeverity + +**Missing description!!** + +## type + +```ts +object<string, string> +``` + +## enum + +* ``"Error"`` +* ``"Warning"`` +* ``"Information"`` +* ``"Hint"`` +* ``"Fallback"`` + +## default + +```json +{ + "ambiguity": "Fallback", + "await": "Fallback", + "codestyle": "Fallback", + "duplicate": "Fallback", + "global": "Fallback", + "luadoc": "Fallback", + "no-unknown": "Fallback", + "redefined": "Fallback", + "strict": "Fallback", + "type-check": "Fallback", + "unbalanced": "Fallback", + "unused": "Fallback" +} +``` + # diagnostics.ignoredFiles How to diagnose ignored files. diff --git a/doc/zh-cn/config.md b/doc/zh-cn/config.md index f8e54ffa..5f2dde49 100644 --- a/doc/zh-cn/config.md +++ b/doc/zh-cn/config.md @@ -240,6 +240,79 @@ Array<string> [] ``` +# diagnostics.groupFileStatus + +**Missing description!!** + +## type + +```ts +object<string, string> +``` + +## enum + +* ``"Any"`` +* ``"Opened"`` +* ``"None"`` +* ``"Fallback"`` + +## default + +```json +{ + "ambiguity": "Fallback", + "await": "Fallback", + "codestyle": "Fallback", + "duplicate": "Fallback", + "global": "Fallback", + "luadoc": "Fallback", + "no-unknown": "Fallback", + "redefined": "Fallback", + "strict": "Fallback", + "type-check": "Fallback", + "unbalanced": "Fallback", + "unused": "Fallback" +} +``` + +# diagnostics.groupSeverity + +**Missing description!!** + +## type + +```ts +object<string, string> +``` + +## enum + +* ``"Error"`` +* ``"Warning"`` +* ``"Information"`` +* ``"Hint"`` +* ``"Fallback"`` + +## default + +```json +{ + "ambiguity": "Fallback", + "await": "Fallback", + "codestyle": "Fallback", + "duplicate": "Fallback", + "global": "Fallback", + "luadoc": "Fallback", + "no-unknown": "Fallback", + "redefined": "Fallback", + "strict": "Fallback", + "type-check": "Fallback", + "unbalanced": "Fallback", + "unused": "Fallback" +} +``` + # diagnostics.ignoredFiles 如何诊断被忽略的文件。 diff --git a/doc/zh-tw/config.md b/doc/zh-tw/config.md index f8050a6e..aa9f85cc 100644 --- a/doc/zh-tw/config.md +++ b/doc/zh-tw/config.md @@ -240,6 +240,79 @@ Array<string> [] ``` +# diagnostics.groupFileStatus + +**Missing description!!** + +## type + +```ts +object<string, string> +``` + +## enum + +* ``"Any"`` +* ``"Opened"`` +* ``"None"`` +* ``"Fallback"`` + +## default + +```json +{ + "ambiguity": "Fallback", + "await": "Fallback", + "codestyle": "Fallback", + "duplicate": "Fallback", + "global": "Fallback", + "luadoc": "Fallback", + "no-unknown": "Fallback", + "redefined": "Fallback", + "strict": "Fallback", + "type-check": "Fallback", + "unbalanced": "Fallback", + "unused": "Fallback" +} +``` + +# diagnostics.groupSeverity + +**Missing description!!** + +## type + +```ts +object<string, string> +``` + +## enum + +* ``"Error"`` +* ``"Warning"`` +* ``"Information"`` +* ``"Hint"`` +* ``"Fallback"`` + +## default + +```json +{ + "ambiguity": "Fallback", + "await": "Fallback", + "codestyle": "Fallback", + "duplicate": "Fallback", + "global": "Fallback", + "luadoc": "Fallback", + "no-unknown": "Fallback", + "redefined": "Fallback", + "strict": "Fallback", + "type-check": "Fallback", + "unbalanced": "Fallback", + "unused": "Fallback" +} +``` + # diagnostics.ignoredFiles 如何診斷被忽略的檔案。 diff --git a/script/config/template.lua b/script/config/template.lua index 6078b5a6..3c55895d 100644 --- a/script/config/template.lua +++ b/script/config/template.lua @@ -244,9 +244,34 @@ local template = { >> util.deepCopy(define.DiagnosticDefaultSeverity), ['Lua.diagnostics.neededFileStatus'] = Type.Hash( Type.String << util.getTableKeys(define.DiagnosticDefaultNeededFileStatus, true), - Type.String << { 'Any', 'Opened', 'None' } + Type.String << { + 'Any', + 'Opened', + 'None', + } ) >> util.deepCopy(define.DiagnosticDefaultNeededFileStatus), + ['Lua.diagnostics.groupSeverity'] = Type.Hash( + Type.String << util.getTableKeys(define.DiagnosticDefaultGroupSeverity, true), + Type.String << { + 'Error', + 'Warning', + 'Information', + 'Hint', + 'Fallback', + } + ) + >> util.deepCopy(define.DiagnosticDefaultGroupSeverity), + ['Lua.diagnostics.groupFileStatus'] = Type.Hash( + Type.String << util.getTableKeys(define.DiagnosticDefaultGroupFileStatus, true), + Type.String << { + 'Any', + 'Opened', + 'None', + 'Fallback', + } + ) + >> util.deepCopy(define.DiagnosticDefaultGroupFileStatus), ['Lua.diagnostics.disableScheme'] = Type.Array(Type.String) >> { 'git' }, ['Lua.diagnostics.workspaceDelay'] = Type.Integer >> 3000, ['Lua.diagnostics.workspaceRate'] = Type.Integer >> 100, diff --git a/script/proto/define.lua b/script/proto/define.lua index fa834cbf..93907847 100644 --- a/script/proto/define.lua +++ b/script/proto/define.lua @@ -16,6 +16,10 @@ m.DiagnosticDefaultSeverity = diag.getDefaultSeverity() --- 诊断类型与需要的文件状态(可以控制只分析打开的文件、还是所有文件) m.DiagnosticDefaultNeededFileStatus = diag.getDefaultStatus() +m.DiagnosticDefaultGroupSeverity = diag.getGroupSeverity() + +m.DiagnosticDefaultGroupFileStatus = diag.getGroupStatus() + --- 诊断报告标签 m.DiagnosticTag = { Unnecessary = 1, diff --git a/script/proto/diagnostic.lua b/script/proto/diagnostic.lua index 09c0596d..cba6a493 100644 --- a/script/proto/diagnostic.lua +++ b/script/proto/diagnostic.lua @@ -201,4 +201,20 @@ function m.getDefaultStatus() return status end +function m.getGroupSeverity() + local group = {} + for name in pairs(m.diagnosticGroups) do + group[name] = 'Fallback' + end + return group +end + +function m.getGroupStatus() + local group = {} + for name in pairs(m.diagnosticGroups) do + group[name] = 'Fallback' + end + return group +end + return m |