From 73ce1e3bf66b47a444378e7fdc68d03d854328ef Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 23 Dec 2024 00:45:56 +0100 Subject: [PATCH] feat: autohotkey_lsp #3408 --- lua/lspconfig/configs/autohotkey_lsp.lua | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 lua/lspconfig/configs/autohotkey_lsp.lua diff --git a/lua/lspconfig/configs/autohotkey_lsp.lua b/lua/lspconfig/configs/autohotkey_lsp.lua new file mode 100644 index 0000000000..839af2fc3e --- /dev/null +++ b/lua/lspconfig/configs/autohotkey_lsp.lua @@ -0,0 +1,56 @@ +-- NOTE: AutoHotkey is used only on windows +local function get_autohotkey_path() + local path = vim.fn.exepath('autohotkey.exe') + return #path > 0 and path or '' +end + +return { + default_config = { + cmd = { 'autohotkey_lsp', '--stdio' }, + filetypes = { 'autohotkey' }, + root_dir = function(fname) + return vim.fs.dirname(vim.fs.find('package.json', { path = fname, upward = true })[1]) + end, + single_file_support = true, + autostart = true, + flags = { debounce_text_changes = 500 }, + --capabilities = capabilities, + --on_attach = custom_attach, + init_options = { + locale = 'en-us', + InterpreterPath = get_autohotkey_path(), + AutoLibInclude = 'All', + CommentTags = '^;;\\s*(?.+)', + CompleteFunctionParens = false, + SymbolFoldinFromOpenBrace = false, + Diagnostics = { + ClassStaticMemberCheck = true, + ParamsCheck = true, + }, + ActionWhenV1IsDetected = 'Continue', + FormatOptions = { + array_style = 'expand', + break_chained_methods = false, + ignore_comment = false, + indent_string = '\t', + max_preserve_newlines = 2, + brace_style = 'One True Brace', + object_style = 'none', + preserve_newlines = true, + space_after_double_colon = true, + space_before_conditional = true, + space_in_empty_paren = false, + space_in_other = true, + space_in_paren = false, + wrap_line_length = 0, + }, + }, + }, + docs = { + description = [[ +https://github.com/thqby/vscode-autohotkey2-lsp + +AutoHotkey v2.0 LSP implementation + ]], + }, +}