summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md3
-rw-r--r--script/glob/matcher.lua2
-rw-r--r--test/tclient/init.lua1
-rw-r--r--test/tclient/tests/files-associations.lua48
4 files changed, 53 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index 9d4162b6..6b8c37af 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,8 @@
# changelog
+## 2.6.7
+* `FIX` [#965](https://github.com/sumneko/lua-language-server/issues/965)
+
## 2.6.6
`2022-2-21`
* `NEW` formatter preview, use `--preview` to enable this feature, [read more](https://github.com/sumneko/lua-language-server/issues/960)
diff --git a/script/glob/matcher.lua b/script/glob/matcher.lua
index fceb32e2..af43e087 100644
--- a/script/glob/matcher.lua
+++ b/script/glob/matcher.lua
@@ -3,7 +3,7 @@ local m = require 'lpeglabel'
local Slash = m.S('/\\')^1
local Symbol = m.S',{}[]*?/\\'
local Char = 1 - Symbol
-local Path = (1 - m.S[[\/:*?"<>|]])^1 * Slash
+local Path = (1 - m.S[[\/*?"<>|]])^1 * Slash
local NoWord = #(m.P(-1) + Symbol)
local function whatHappened()
return m.Cmt(m.P(1)^1, function (...)
diff --git a/test/tclient/init.lua b/test/tclient/init.lua
index 99b34867..7c8d70ef 100644
--- a/test/tclient/init.lua
+++ b/test/tclient/init.lua
@@ -3,3 +3,4 @@ require 'tclient.tests.library-ignore-limit'
require 'tclient.tests.multi-workspace'
require 'tclient.tests.folders-with-single-file'
require 'tclient.tests.load-library'
+require 'tclient.tests.files-associations'
diff --git a/test/tclient/tests/files-associations.lua b/test/tclient/tests/files-associations.lua
new file mode 100644
index 00000000..f8f862a9
--- /dev/null
+++ b/test/tclient/tests/files-associations.lua
@@ -0,0 +1,48 @@
+local lclient = require 'tclient.lclient'
+local ws = require 'workspace'
+local files = require 'files'
+local furi = require 'file-uri'
+local util = require 'utility'
+local fs = require 'bee.filesystem'
+
+local rootPath = LOGPATH .. '/files-associations'
+local rootUri = furi.encode(rootPath)
+
+fs.create_directories(fs.path(rootPath))
+
+local filePath = rootPath .. '/test.lua.txt'
+local fileUri = furi.encode(filePath)
+util.saveFile(filePath, '')
+
+---@async
+lclient():start(function (client)
+ client:registerFakers()
+
+ client:register('workspace/configuration', function ()
+ return {
+ {},
+ {
+ ["*.lua.txt"] = "lua",
+ }
+ }
+ end)
+
+ client:initialize {
+ rootPath = rootPath,
+ rootUri = rootUri,
+ workspaceFolders = {
+ {
+ name = 'ws',
+ uri = rootUri,
+ },
+ }
+ }
+
+ ws.awaitReady(rootUri)
+
+ assert(files.isLua(furi.encode 'aaa.lua.txt') == true)
+ assert(files.isLua(furi.encode '/aaa.lua.txt') == true)
+ assert(files.isLua(furi.encode 'D:\\aaa.lua.txt') == true)
+ assert(files.isLua(fileUri) == true)
+ assert(files.exists(fileUri) == true)
+end)