summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-21 15:11:53 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-21 15:11:53 +0800
commitf25d34705e62abbef53d4975230f4a26834e7e55 (patch)
tree46fadad2ef98db39e988175493d8e9f65400da0e
parentf2f6e87895b83e6434dce2c4493042799311f52f (diff)
downloadlua-language-server-f25d34705e62abbef53d4975230f4a26834e7e55.zip
fix gitignore pattern `\` broken initialization
-rw-r--r--changelog.md2
-rw-r--r--script/glob/matcher.lua10
2 files changed, 11 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index cb4e6d0f..0be6a699 100644
--- a/changelog.md
+++ b/changelog.md
@@ -9,6 +9,8 @@
---@field ['#'] number
```
* `NEW` add supports of `love2d`
+* `FIX` gitignore pattern `\` broken initialization
+* `FIX` runtime errors
## 2.3.1
`2021-7-19`
diff --git a/script/glob/matcher.lua b/script/glob/matcher.lua
index f4c2b12c..0a2a740f 100644
--- a/script/glob/matcher.lua
+++ b/script/glob/matcher.lua
@@ -123,7 +123,12 @@ end
function mt:pattern(state)
if state.root then
- return m.C(self:exp(state, 1))
+ local after = self:exp(state, 1)
+ if after then
+ return m.C(after)
+ else
+ return nil
+ end
else
return m.C(self:anyPath(nil, state, 1))
end
@@ -147,5 +152,8 @@ return function (state, options)
state = state,
}, mt)
self.matcher = self:pattern(state)
+ if not self.matcher then
+ return nil
+ end
return self
end