diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 369fbb9..a9bb316 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,10 +12,13 @@ jobs: strategy: matrix: include: - - {target: win32-x64, file: EmmyLua.LanguageServer-win32-x64.zip} - - {target: linux-x64, file: EmmyLua.LanguageServer-linux-x64.tar.gz} - - {target: darwin-x64, file: EmmyLua.LanguageServer-darwin-x64.zip} - - {target: darwin-arm64, file: EmmyLua.LanguageServer-darwin-arm64.zip} + - {target: win32-x64, file: emmylua_ls-win32-x64.zip} + - {target: win32-ia32, file: emmylua_ls-win32-ia32.zip} + - {target: win32-arm64, file: emmylua_ls-win32-arm64.zip} + - {target: linux-x64, file: emmylua_ls-linux-x64-glibc.2.17.tar.gz} + - {target: linux-arm64, file: emmylua_ls-linux-aarch64-glibc.2.17.tar.gz} + - {target: darwin-x64, file: emmylua_ls-darwin-x64.zip} + - {target: darwin-arm64, file: emmylua_ls-darwin-arm64.zip} runs-on: ubuntu-latest diff --git a/build/config.js b/build/config.js index 0c91eff..fe5975d 100644 --- a/build/config.js +++ b/build/config.js @@ -1,6 +1,6 @@ exports.default = { emmyDebuggerVersion: '1.8.2', emmyDebuggerUrl: 'https://github.com/EmmyLua/EmmyLuaDebugger/releases/download', - newLanguageServerVersion: "0.7.1", - newLanguageServerUrl: "https://github.com/CppCXY/EmmyLuaAnalyzer/releases/download" + newLanguageServerVersion: "0.1.5", + newLanguageServerUrl: "https://github.com/CppCXY/emmylua-analyzer-rust/releases/download" } diff --git a/package.json b/package.json index 231cf33..c671665 100644 --- a/package.json +++ b/package.json @@ -272,22 +272,9 @@ "type": "string", "default": "#FF6699" }, - "emmylua.colors.upvalue": { - "type": "string", - "default": "#a8c023" - }, "emmylua.colors.local": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Local variable colors", - "default": [ - "#66CCFF", - "#ADD8E6", - "#FFA07A", - "#90EE90" - ] + "type": "string", + "default": "#66CCFF" } } }, diff --git a/src/annotator.ts b/src/annotator.ts index 1ca3f00..f5a0b1d 100644 --- a/src/annotator.ts +++ b/src/annotator.ts @@ -1,4 +1,3 @@ - import * as vscode from 'vscode'; import { AnnotatorType } from './lspExt'; import { LanguageClient } from 'vscode-languageclient/node'; @@ -7,57 +6,60 @@ import * as notifications from "./lspExt"; let D_PARAM: vscode.TextEditorDecorationType; let D_GLOBAL: vscode.TextEditorDecorationType; -let D_LOCALS: vscode.TextEditorDecorationType[]; -let D_UPVALUE: vscode.TextEditorDecorationType; +let D_LOCAL: vscode.TextEditorDecorationType; +let D_MUT_LOCAL: vscode.TextEditorDecorationType; +let D_MUT_PARAM: vscode.TextEditorDecorationType; -function createDecoration(key: string | undefined, config: vscode.DecorationRenderOptions = {}): vscode.TextEditorDecorationType { - if (key == undefined) { - return vscode.window.createTextEditorDecorationType(config); - } +function createDecoration(key: string): vscode.TextEditorDecorationType { + let config: vscode.DecorationRenderOptions = {} let color = vscode.workspace.getConfiguration("emmylua").get(key); if (typeof (color) === 'string') { - config.light = { color: color }; - config.dark = { color: color }; + config.light = { color }; + config.dark = { color }; } return vscode.window.createTextEditorDecorationType(config); } -function createDecorations(key: string, config: vscode.DecorationRenderOptions = {}): vscode.TextEditorDecorationType[] { - let colors = vscode.workspace.getConfiguration("emmylua").get(key); - if (colors instanceof Array) { - return colors.map(color => vscode.window.createTextEditorDecorationType({ - light: { color: color }, - dark: { color: color } - })); +function createDecorationUnderline(key: string): vscode.TextEditorDecorationType { + let config: vscode.DecorationRenderOptions = {} + let color = vscode.workspace.getConfiguration("emmylua").get(key); + if (typeof (color) === 'string') { + config.light = { + color, + textDecoration: `underline;text-decoration-color:${color};` + }; + config.dark = { + color, + textDecoration: `underline;text-decoration-color:${color};` + }; + } else { + config.light = { + textDecoration: `underline;` + }; + config.dark = { + textDecoration: `underline;` + }; } - return []; + return vscode.window.createTextEditorDecorationType(config); +} + +function disposeDecorations(...decorations: (vscode.TextEditorDecorationType | undefined)[]) { + decorations.forEach(d => d && d.dispose()); } function updateDecorations() { - // 各种方式更新时之前的decoration没有dispose导致重复渲染 if (D_PARAM) { - D_PARAM.dispose(); - D_GLOBAL.dispose(); - D_LOCALS.forEach(d => d.dispose()); - D_UPVALUE.dispose(); + disposeDecorations(D_PARAM, D_GLOBAL, D_LOCAL, D_MUT_LOCAL, D_MUT_PARAM); } D_PARAM = createDecoration("colors.parameter"); D_GLOBAL = createDecoration("colors.global"); - D_LOCALS = createDecorations("colors.local"); - - let upvalueColor = vscode.workspace.getConfiguration("emmylua").get("colors.upvalue"); - if (upvalueColor && upvalueColor != "") { - D_UPVALUE = createDecoration(undefined, { - textDecoration: `underline;text-decoration-color:${upvalueColor};` - }); - } - else { - D_UPVALUE = createDecoration(undefined); - } + D_LOCAL = createDecoration("colors.local"); + D_MUT_LOCAL = createDecorationUnderline("colors.local"); + D_MUT_PARAM = createDecorationUnderline("colors.parameter"); } -export function onDidChangeConfiguration(client: LanguageClient) { +export function onDidChangeConfiguration() { updateDecorations(); } @@ -78,62 +80,44 @@ function requestAnnotatorsImpl(editor: vscode.TextEditor, client: LanguageClient let params: notifications.AnnotatorParams = { uri: editor.document.uri.toString() }; client.sendRequest("emmy/annotator", params).then(list => { let map: Map = new Map(); - map.set(AnnotatorType.Param, []); + map.set(AnnotatorType.ReadOnlyParam, []); map.set(AnnotatorType.Global, []); - map.set(AnnotatorType.Upvalue, []); - - let local_maps = new Map(); - for (let i = 0; i < D_LOCALS.length; i++) { - local_maps.set(i, []); - } + map.set(AnnotatorType.ReadOnlyLocal, []); + map.set(AnnotatorType.MutLocal, []); + map.set(AnnotatorType.MutParam, []); if (!list) { return; } - let local_index = 0; - list.forEach(annotation => { - if (annotation.type !== AnnotatorType.Local) { - let ranges = map.get(annotation.type); - if (ranges) { - ranges.push(...annotation.ranges); - } - } else if (D_LOCALS.length > 0) { - let ranges = local_maps.get(local_index); - if (!ranges) { - ranges = []; - local_maps.set(local_index, ranges); - } + let ranges = map.get(annotation.type); + if (ranges) { ranges.push(...annotation.ranges); - local_index++; - if (local_index >= D_LOCALS.length) { - local_index = 0; - } } }); map.forEach((v, k) => { updateAnnotators(editor, k, v); }); - - local_maps.forEach((v, i) => { - if (i < D_LOCALS.length) { - editor.setDecorations(D_LOCALS[i], v); - } - }); }); } function updateAnnotators(editor: vscode.TextEditor, type: AnnotatorType, ranges: vscode.Range[]) { switch (type) { - case AnnotatorType.Param: + case AnnotatorType.ReadOnlyParam: editor.setDecorations(D_PARAM, ranges); break; case AnnotatorType.Global: editor.setDecorations(D_GLOBAL, ranges); break; - case AnnotatorType.Upvalue: - editor.setDecorations(D_UPVALUE, ranges); + case AnnotatorType.ReadOnlyLocal: + editor.setDecorations(D_LOCAL, ranges); + break; + case AnnotatorType.MutLocal: + editor.setDecorations(D_MUT_LOCAL, ranges); + break; + case AnnotatorType.MutParam: + editor.setDecorations(D_MUT_PARAM, ranges); break; } } diff --git a/src/extension.ts b/src/extension.ts index b634df2..79f6038 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -16,6 +16,7 @@ import { InlineDebugAdapterFactory } from './debugger/DebugFactory' import * as os from 'os'; import * as fs from 'fs'; import { IServerLocation, IServerPosition } from './lspExt'; +import { onDidChangeConfiguration } from './annotator'; export let ctx: EmmyContext; let activeEditor: vscode.TextEditor; @@ -34,6 +35,13 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(onDidChangeActiveTextEditor, null, context.subscriptions)); context.subscriptions.push(vscode.commands.registerCommand("emmy.insertEmmyDebugCode", insertEmmyDebugCode)); context.subscriptions.push(vscode.languages.setLanguageConfiguration("lua", new LuaLanguageConfiguration())); + context.subscriptions.push( + vscode.workspace.onDidChangeConfiguration(e => { + if (e.affectsConfiguration("emmylua")) { + onDidChangeConfiguration() + } + }) + ); startServer(); registerDebuggers(); return { @@ -97,17 +105,26 @@ async function startServer() { }); } +const serverPaths: { [key: string]: { [key: string]: string } } = { + win32: { + arm64: 'emmylua_ls-win32-arm64', + x64: 'emmylua_ls-win32-x64', + ia32: 'emmylua_ls-win32-ia32' + }, + linux: { + arm64: 'emmylua_ls-linux-aarch64-glibc.2.17', + x64: 'emmylua_ls-linux-x64-glibc.2.17' + }, + darwin: { + arm64: 'emmylua_ls-darwin-arm64', + x64: 'emmylua_ls-darwin-x64' + } +}; + async function doStartServer() { const context = ctx.extensionContext; const clientOptions: LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: ctx.LANGUAGE_ID }], - // synchronize: { - // configurationSection: ["emmylua", "files.associations"], - // fileEvents: [ - // vscode.workspace.createFileSystemWatcher("**/*.lua"), - // vscode.workspace.createFileSystemWatcher("**/.editorconfig"), - // ] - // }, initializationOptions: {} }; @@ -130,54 +147,20 @@ async function doStartServer() { return Promise.resolve(result); }; } else { - let platform: string = os.platform(); + let platform = os.platform(); + let arch = os.arch(); + let executableName = platform === 'win32' ? 'emmylua_ls.exe' : 'emmylua_ls'; + + const serverDir = serverPaths[platform]?.[arch]; + if (!serverDir) { + vscode.window.showErrorMessage(`Unsupported platform: ${platform} ${arch}`); + return; + } + + const command = path.join(context.extensionPath, 'server', serverDir, executableName); - let command: string = ""; - switch (platform) { - case "win32": - command = path.join( - context.extensionPath, - 'server', - 'emmylua_ls-win32-x64', - 'emmylua_ls.exe' - ) - break; - case "linux": - if (os.arch() === "arm64") { - command = path.join( - context.extensionPath, - 'server', - 'emmylua_ls-linux-arm64', - 'emmylua_ls' - ); - } else { - command = path.join( - context.extensionPath, - 'server', - 'emmylua_ls-linux-x64', - 'emmylua_ls' - ); - } - fs.chmodSync(command, '777'); - break; - case "darwin": - if (os.arch() === "arm64") { - command = path.join( - context.extensionPath, - 'server', - 'emmylua_ls-darwin-arm64', - 'emmylua_ls' - ); - } else { - command = path.join( - context.extensionPath, - 'server', - 'emmylua_ls-darwin-x64', - 'emmylua_ls' - ); - } - fs.chmodSync(command, '777'); - break; + if (platform !== 'win32') { + fs.chmodSync(command, '777'); } serverOptions = { command: command, diff --git a/src/lspExt.ts b/src/lspExt.ts index a51fad9..a6dcebb 100644 --- a/src/lspExt.ts +++ b/src/lspExt.ts @@ -5,10 +5,11 @@ export interface AnnotatorParams { } export enum AnnotatorType { - Param, + ReadOnlyParam, Global, - Local, - Upvalue, + ReadOnlyLocal, + MutLocal, + MutParam, } export interface IAnnotator { diff --git a/syntaxes/emmy.config.schema.json b/syntaxes/emmy.config.schema.json deleted file mode 100644 index 5cbcaf6..0000000 --- a/syntaxes/emmy.config.schema.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "EmmyLua Configuration", - "type": "object", - "properties": { - "lua.version": { - "type": "string", - "enum": ["lua5.1", "lua5.2", "lua5.3", "lua5.4"] - }, - "source": { - "type": "array", - "items": { - "$ref": "#/definitions/sourceRoot", - "required": ["dir"] - } - }, - "editor": { - "type": "object", - "properties": { - "completionCaseSensitive": { - "type": "boolean" - } - } - } - }, - "additionalProperties": false, - "required": [ - ], - "definitions": { - "sourceRoot": { - "type": "object", - "properties": { - "dir": { - "type": "string" - }, - "exclude": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } -} \ No newline at end of file diff --git a/syntaxes/schema.json b/syntaxes/schema.json index 20e9e27..2354d3e 100644 --- a/syntaxes/schema.json +++ b/syntaxes/schema.json @@ -1,432 +1,590 @@ { - "definitions": { - "CodeLens": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Emmyrc", + "type": "object", + "properties": { + "$schema": { "type": [ - "object", + "string", "null" - ], + ] + }, + "codeLens": { + "default": { + "enable": true + }, + "allOf": [ + { + "$ref": "#/definitions/EmmyrcCodeLen" + } + ] + }, + "completion": { + "default": { + "autoRequire": true, + "autoRequireFunction": "require", + "autoRequireNamingConvention": "keep", + "callSnippet": false, + "enable": true, + "postfix": "@" + }, + "allOf": [ + { + "$ref": "#/definitions/EmmyrcCompletion" + } + ] + }, + "diagnostics": { + "default": { + "disable": [], + "enable": true, + "enables": [], + "globals": [], + "globalsRegex": [], + "severity": {} + }, + "allOf": [ + { + "$ref": "#/definitions/EmmyrcDiagnostic" + } + ] + }, + "hint": { + "default": { + "enable": true, + "indexHint": true, + "localHint": true, + "overrideHint": true, + "paramHint": true + }, + "allOf": [ + { + "$ref": "#/definitions/EmmyrcInlayHint" + } + ] + }, + "hover": { + "default": { + "enable": true + }, + "allOf": [ + { + "$ref": "#/definitions/EmmyrcHover" + } + ] + }, + "references": { + "default": { + "enable": true, + "fuzzySearch": true + }, + "allOf": [ + { + "$ref": "#/definitions/EmmyrcReference" + } + ] + }, + "resource": { + "default": { + "paths": [] + }, + "allOf": [ + { + "$ref": "#/definitions/EmmyrcResource" + } + ] + }, + "runtime": { + "default": { + "extensions": [], + "frameworkVersions": [], + "requireLikeFunction": [], + "requirePattern": [], + "version": "LuaLatest" + }, + "allOf": [ + { + "$ref": "#/definitions/EmmyrcRuntime" + } + ] + }, + "semanticTokens": { + "default": { + "enable": true + }, + "allOf": [ + { + "$ref": "#/definitions/EmmyrcSemanticToken" + } + ] + }, + "signature": { + "default": { + "detailSignatureHelper": true + }, + "allOf": [ + { + "$ref": "#/definitions/EmmyrcSignature" + } + ] + }, + "strict": { + "default": { + "requirePath": true, + "typeCall": false + }, + "allOf": [ + { + "$ref": "#/definitions/EmmyrcStrict" + } + ] + }, + "workspace": { + "default": { + "encoding": "utf-8", + "ignoreDir": [], + "ignoreGlobs": [], + "library": [], + "preloadFileSize": 0, + "workspaceRoots": [] + }, + "allOf": [ + { + "$ref": "#/definitions/EmmyrcWorkspace" + } + ] + } + }, + "definitions": { + "DiagnosticCode": { + "type": "string", + "enum": [ + "none", + "syntax-error", + "type-not-found", + "missing-return", + "type-not-match", + "missing-parameter", + "inject-field-fail", + "unreachable-code", + "unused", + "undefined-global", + "need-import", + "deprecated", + "access-private-member", + "access-protected-member", + "access-package-member", + "no-discard", + "disable-global-define", + "undefined-field", + "local-const-reassign", + "duplicate-type" + ] + }, + "DiagnosticSeveritySetting": { + "oneOf": [ + { + "description": "Represents an error diagnostic severity.", + "type": "string", + "enum": [ + "error" + ] + }, + { + "description": "Represents a warning diagnostic severity.", + "type": "string", + "enum": [ + "warning" + ] + }, + { + "description": "Represents an information diagnostic severity.", + "type": "string", + "enum": [ + "information" + ] + }, + { + "description": "Represents a hint diagnostic severity.", + "type": "string", + "enum": [ + "hint" + ] + } + ] + }, + "EmmyrcCodeLen": { + "type": "object", "properties": { "enable": { + "description": "Whether to enable code lens.", + "default": true, "type": "boolean" } } }, - "Completion": { - "type": [ - "object", - "null" - ], + "EmmyrcCompletion": { + "description": "Configuration for EmmyLua code completion.", + "type": "object", "properties": { "autoRequire": { + "description": "Whether to automatically require modules.", + "default": true, "type": "boolean" }, "autoRequireFunction": { - "type": [ - "string", - "null" - ] + "description": "The function used for auto-requiring modules.", + "default": "require", + "type": "string" }, "autoRequireNamingConvention": { - "type": "string", - "enum": [ - "none", - "camelCase", - "pascalCase", - "snakeCase" + "description": "The naming convention for auto-required filenames.", + "default": "keep", + "allOf": [ + { + "$ref": "#/definitions/EmmyrcFilenameConvention" + } ] }, "callSnippet": { + "description": "Whether to use call snippets in completions.", + "default": false, + "type": "boolean" + }, + "enable": { + "description": "Whether to enable code completion.", + "default": true, "type": "boolean" }, "postfix": { - "type": [ - "string", - "null" - ] + "description": "The postfix trigger used in completions.", + "default": "@", + "type": "string" } } }, - "Diagnostics": { - "type": [ - "object", - "null" - ], + "EmmyrcDiagnostic": { + "description": "Represents the diagnostic configuration for Emmyrc.", + "type": "object", "properties": { "disable": { - "type": [ - "array", - "null" - ], + "description": "A list of diagnostic codes that are disabled.", + "default": [], + "type": "array", "items": { - "type": "string", - "enum": [ - "none", - "syntax-error", - "type-not-found", - "missing-return", - "type-not-match", - "missing-parameter", - "inject-field-fail", - "unreachable-code", - "unused", - "undefined-global", - "need-import", - "deprecated", - "access-private-member", - "access-protected-member", - "access-package-member", - "no-discard", - "disable-global-define", - "undefined-field", - "local-const-reassign" - ] + "$ref": "#/definitions/DiagnosticCode" } }, "enable": { - "type": [ - "boolean", - "null" - ] + "description": "A flag indicating whether diagnostics are enabled.", + "default": true, + "type": "boolean" + }, + "enables": { + "description": "A list of diagnostic codes that are enabled.", + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/DiagnosticCode" + } }, "globals": { - "type": [ - "array", - "null" - ], + "description": "A list of global variables.", + "default": [], + "type": "array", "items": { - "type": [ - "string", - "null" - ] + "type": "string" } }, "globalsRegex": { - "type": [ - "array", - "null" - ], + "description": "A list of regular expressions for global variables.", + "default": [], + "type": "array", "items": { - "type": [ - "string", - "null" - ] + "type": "string" } }, "severity": { + "description": "A map of diagnostic codes to their severity settings.", + "default": {}, "type": "object", - "properties": { - "none": { - "type": "string", - "enum": [ - "error", - "warning", - "information", - "hint" - ] - }, - "syntax-error": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "type-not-found": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "missing-return": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "type-not-match": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "missing-parameter": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "inject-field-fail": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "unreachable-code": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "unused": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "undefined-global": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "need-import": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "deprecated": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "access-private-member": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "access-protected-member": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "access-package-member": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "no-discard": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "disable-global-define": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "undefined-field": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "local-const-reassign": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - }, - "*": { - "$ref": "#/definitions/Diagnostics/properties/severity/properties/none" - } + "additionalProperties": { + "$ref": "#/definitions/DiagnosticSeveritySetting" } + } + } + }, + "EmmyrcFilenameConvention": { + "oneOf": [ + { + "description": "Keep the original filename.", + "type": "string", + "enum": [ + "keep" + ] }, - "enables": { - "type": [ - "array", - "null" - ], - "items": { - "type": "string", - "enum": [ - "none", - "syntax-error", - "type-not-found", - "missing-return", - "type-not-match", - "missing-parameter", - "inject-field-fail", - "unreachable-code", - "unused", - "undefined-global", - "need-import", - "deprecated", - "access-private-member", - "access-protected-member", - "access-package-member", - "no-discard", - "disable-global-define", - "undefined-field", - "local-const-reassign" - ] - } + { + "description": "Convert the filename to snake_case.", + "type": "string", + "enum": [ + "snake-case" + ] + }, + { + "description": "Convert the filename to PascalCase.", + "type": "string", + "enum": [ + "pascal-case" + ] + }, + { + "description": "Convert the filename to camelCase.", + "type": "string", + "enum": [ + "camel-case" + ] + } + ] + }, + "EmmyrcHover": { + "type": "object", + "properties": { + "enable": { + "description": "Whether to enable hover.", + "default": true, + "type": "boolean" } } }, - "Hint": { - "type": [ - "object", - "null" - ], + "EmmyrcInlayHint": { + "type": "object", "properties": { - "paramHint": { + "enable": { + "description": "Whether to enable inlay hints.", + "default": true, "type": "boolean" }, "indexHint": { + "description": "Whether to enable index hints.", + "default": true, "type": "boolean" }, "localHint": { + "description": "Whether to enable local hints. Whether to enable override hints.", + "default": true, "type": "boolean" }, "overrideHint": { + "description": "Whether to enable override hints.", + "default": true, + "type": "boolean" + }, + "paramHint": { + "description": "Whether to enable parameter hints.", + "default": true, "type": "boolean" } } }, - "Resource": { - "type": [ - "object", - "null" - ], + "EmmyrcLuaVersion": { + "oneOf": [ + { + "description": "Lua 5.1", + "type": "string", + "enum": [ + "Lua5.1" + ] + }, + { + "description": "LuaJIT", + "type": "string", + "enum": [ + "LuaJIT" + ] + }, + { + "description": "Lua 5.2", + "type": "string", + "enum": [ + "Lua5.2" + ] + }, + { + "description": "Lua 5.3", + "type": "string", + "enum": [ + "Lua5.3" + ] + }, + { + "description": "Lua 5.4", + "type": "string", + "enum": [ + "Lua5.4" + ] + }, + { + "description": "Lua 5.4", + "type": "string", + "enum": [ + "LuaLatest" + ] + } + ] + }, + "EmmyrcReference": { + "type": "object", + "properties": { + "enable": { + "description": "Whether to enable reference search.", + "default": true, + "type": "boolean" + }, + "fuzzySearch": { + "description": "Determines whether to enable fuzzy searching for fields where references cannot be found.", + "default": true, + "type": "boolean" + } + } + }, + "EmmyrcResource": { + "type": "object", "properties": { "paths": { - "type": [ - "array", - "null" - ], + "default": [], + "type": "array", "items": { - "type": [ - "string", - "null" - ] + "type": "string" } } } }, - "Runtime": { - "type": [ - "object", - "null" - ], + "EmmyrcRuntime": { + "type": "object", "properties": { - "version": { - "type": "string", - "enum": [ - "Lua5.1", - "LuaJIT", - "Lua5.2", - "Lua5.3", - "Lua5.4", - "LuaLatest" - ] - }, - "requireLikeFunction": { - "type": [ - "array", - "null" - ], + "extensions": { + "description": "file Extensions. eg: .lua, .lua.txt", + "default": [], + "type": "array", "items": { - "type": [ - "string", - "null" - ] + "type": "string" } }, "frameworkVersions": { - "type": [ - "array", - "null" - ], + "description": "Framework versions.", + "default": [], + "type": "array", "items": { - "type": [ - "string", - "null" - ] + "type": "string" } }, - "extensions": { - "type": [ - "array", - "null" - ], + "requireLikeFunction": { + "description": "Functions that like require.", + "default": [], + "type": "array", "items": { - "type": [ - "string", - "null" - ] + "type": "string" } }, "requirePattern": { - "type": [ - "array", - "null" - ], + "description": "Require pattern. eg. \"?.lua\", \"?/init.lua\"", + "default": [], + "type": "array", "items": { - "type": [ - "string", - "null" - ] + "type": "string" } + }, + "version": { + "description": "Lua version.", + "default": "LuaLatest", + "allOf": [ + { + "$ref": "#/definitions/EmmyrcLuaVersion" + } + ] } } }, - "Strict": { - "type": [ - "object", - "null" - ], + "EmmyrcSemanticToken": { + "type": "object", + "properties": { + "enable": { + "description": "Whether to enable semantic token.", + "default": true, + "type": "boolean" + } + } + }, + "EmmyrcSignature": { + "type": "object", + "properties": { + "detailSignatureHelper": { + "description": "Whether to enable signature help.", + "default": true, + "type": "boolean" + } + } + }, + "EmmyrcStrict": { + "type": "object", "properties": { "requirePath": { + "description": "Whether to enable strict mode require path.", + "default": true, "type": "boolean" }, "typeCall": { + "default": false, "type": "boolean" } } }, - "Workspace": { - "type": [ - "object", - "null" - ], + "EmmyrcWorkspace": { + "type": "object", "properties": { + "encoding": { + "description": "Encoding. eg: \"utf-8\"", + "default": "utf-8", + "type": "string" + }, "ignoreDir": { - "type": [ - "array", - "null" - ], + "description": "Ignore directories.", + "default": [], + "type": "array", "items": { - "type": [ - "string", - "null" - ] + "type": "string" } }, "ignoreGlobs": { - "type": [ - "array", - "null" - ], + "description": "Ignore globs. eg: [\"**/*.lua\"]", + "default": [], + "type": "array", "items": { - "type": [ - "string", - "null" - ] + "type": "string" } }, "library": { - "type": [ - "array", - "null" - ], + "description": "Library paths. eg: \"/usr/local/share/lua/5.1\"", + "default": [], + "type": "array", "items": { - "type": [ - "string", - "null" - ] + "type": "string" } }, + "preloadFileSize": { + "default": 0, + "type": "integer", + "format": "int32" + }, "workspaceRoots": { - "type": [ - "array", - "null" - ], + "description": "Workspace roots. eg: [\"src\", \"test\"]", + "default": [], + "type": "array", "items": { - "type": [ - "string", - "null" - ] + "type": "string" } - }, - "preloadFileSize": { - "type": "integer" } } } - }, - "type": "object", - "properties": { - "$schema": { - "type": [ - "string", - "null" - ] - }, - "completion": { - "$ref": "#/definitions/Completion" - }, - "diagnostics": { - "$ref": "#/definitions/Diagnostics" - }, - "hint": { - "$ref": "#/definitions/Hint" - }, - "runtime": { - "$ref": "#/definitions/Runtime" - }, - "workspace": { - "$ref": "#/definitions/Workspace" - }, - "resource": { - "$ref": "#/definitions/Resource" - }, - "codeLens": { - "$ref": "#/definitions/CodeLens" - }, - "strict": { - "$ref": "#/definitions/Strict" - } } -} +} \ No newline at end of file