From b54cc1aeb2b8613cb502467cd6b8500445663b50 Mon Sep 17 00:00:00 2001 From: Harley Laue Date: Fri, 29 Dec 2023 06:44:51 -0800 Subject: [PATCH 1/2] fix(ols): remove single_file_support It doesn't seem like ols really has support for single_file_support. The ols application crashes with the following message: "ols/src/server/requests.odin(1494:28) Index 0 is out of range 0..<0\n" This happens on workspace/didChangeConfiguration when settings are provided in the users' ols setup. To work around this, essentially turning off single_file_support & adding *.odin as a way to detect a root_dir. This isn't very common but at least one other language server uses this method, qml_ls. However, without this, the ols doesn't really work out of the box for projects that lack a .git directory or ols.json file. --- lua/lspconfig/server_configurations/ols.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/lspconfig/server_configurations/ols.lua b/lua/lspconfig/server_configurations/ols.lua index 65dd085c7e..965fa6cf3f 100644 --- a/lua/lspconfig/server_configurations/ols.lua +++ b/lua/lspconfig/server_configurations/ols.lua @@ -4,8 +4,8 @@ return { default_config = { cmd = { 'ols' }, filetypes = { 'odin' }, - root_dir = util.root_pattern('ols.json', '.git'), - single_file_support = true, + root_dir = util.root_pattern('ols.json', '.git', '*.odin'), + single_file_support = false, }, docs = { description = [[ @@ -14,7 +14,7 @@ return { `Odin Language Server`. ]], default_config = { - root_dir = [[util.root_pattern("ols.json", ".git")]], + root_dir = [[util.root_pattern("ols.json", ".git", "*.odin")]], }, }, } From b2660e840e4d467ae027f06ac03d69c0acb1eb86 Mon Sep 17 00:00:00 2001 From: Harley Laue Date: Sat, 30 Dec 2023 14:46:34 -0800 Subject: [PATCH 2/2] fix(ols): remove single_file_support that defaults to false --- lua/lspconfig/server_configurations/ols.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lspconfig/server_configurations/ols.lua b/lua/lspconfig/server_configurations/ols.lua index 965fa6cf3f..6b890f60b7 100644 --- a/lua/lspconfig/server_configurations/ols.lua +++ b/lua/lspconfig/server_configurations/ols.lua @@ -5,7 +5,6 @@ return { cmd = { 'ols' }, filetypes = { 'odin' }, root_dir = util.root_pattern('ols.json', '.git', '*.odin'), - single_file_support = false, }, docs = { description = [[