Skip to content

Commit 6e9238c

Browse files
committed
feat: add server configuration for autohotkey_lsp
updated per PR Update readme
1 parent bc6ada4 commit 6e9238c

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
-- NOTE: AutoHotkey is used only on windows
2+
local util = require 'lspconfig.util'
3+
4+
local function get_autohotkey_path()
5+
local handle = vim.fn.exepath('autohotkey.exe')
6+
local result = handle:read '*a'
7+
handle:close()
8+
9+
result = result:gsub('%s+$', '')
10+
11+
return result == '' and 'autohotkey.exe' or result
12+
end
13+
14+
return {
15+
default_config = {
16+
cmd = { 'vscode-autohotkey2-lsp', '--stdio' },
17+
filetypes = { 'autohotkey', 'ahk', 'ah2' },
18+
root_dir = util.find_package_json_ancestor,
19+
single_file_support = true,
20+
autostart = true,
21+
flags = { debounce_text_changes = 500 },
22+
--capabilities = capabilities,
23+
--on_attach = custom_attach,
24+
init_options = {
25+
locale = 'en-us',
26+
InterpreterPath = get_autohotkey_path(),
27+
AutoLibInclude = 'All',
28+
CommentTags = '^;;\\s*(?<tag>.+)',
29+
CompleteFunctionParens = false,
30+
SymbolFoldinFromOpenBrace = false,
31+
Diagnostics = {
32+
ClassStaticMemberCheck = true,
33+
ParamsCheck = true,
34+
},
35+
ActionWhenV1IsDetected = 'Continue',
36+
FormatOptions = {
37+
array_style = 'expand',
38+
break_chained_methods = false,
39+
ignore_comment = false,
40+
indent_string = '\t',
41+
max_preserve_newlines = 2,
42+
brace_style = 'One True Brace',
43+
object_style = 'none',
44+
preserve_newlines = true,
45+
space_after_double_colon = true,
46+
space_before_conditional = true,
47+
space_in_empty_paren = false,
48+
space_in_other = true,
49+
space_in_paren = false,
50+
wrap_line_length = 0,
51+
},
52+
},
53+
},
54+
docs = {
55+
description = [[
56+
https://www.autohotkey.com
57+
58+
AutoHotkey v2.0 LSP implementation
59+
]],
60+
},
61+
}

0 commit comments

Comments
 (0)