Skip to content

Commit 375fde9

Browse files
committed
fix #402 should not match . as last character
1 parent df5bd54 commit 375fde9

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* `FIX` completion: interface in nested table
66
* `FIX` completion: interface not show after `,`
77
* `FIX` [#400](https://github.com/sumneko/lua-language-server/issues/400)
8+
* `FIX` [#402](https://github.com/sumneko/lua-language-server/issues/402)
89
* `FIX` runtime errors
910

1011
## 1.16.0

script/library.lua

+17-4
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,26 @@ end
3939
local function convertLink(text)
4040
local fmt = getDocFormater()
4141
return text:gsub('%$([%.%w]+)', function (name)
42+
local lastDot = ''
43+
if name:sub(-1) == '.' then
44+
name = name:sub(1, -2)
45+
lastDot = '.'
46+
end
4247
if fmt then
43-
return ('[%s](%s)'):format(name, lang.script(fmt, 'pdf-' .. name))
48+
return ('[%s](%s)'):format(name, lang.script(fmt, 'pdf-' .. name)) .. lastDot
4449
else
45-
return ('`%s`'):format(name)
50+
return ('`%s`'):format(name) .. lastDot
4651
end
4752
end):gsub('§([%.%w]+)', function (name)
53+
local lastDot = ''
54+
if name:sub(-1) == '.' then
55+
name = name:sub(1, -2)
56+
lastDot = '.'
57+
end
4858
if fmt then
49-
return ('[§%s](%s)'):format(name, lang.script(fmt, name))
59+
return ('[§%s](%s)'):format(name, lang.script(fmt, name)) .. lastDot
5060
else
51-
return ('`%s`'):format(name)
61+
return ('`%s`'):format(name) .. lastDot
5262
end
5363
end)
5464
end
@@ -59,6 +69,9 @@ local function createViewDocument(name)
5969
return nil
6070
end
6171
name = name:match '[%w_%.]+'
72+
if name:sub(-1) == '.' then
73+
name = name:sub(1, -2)
74+
end
6275
return ('[%s](%s)'):format(lang.script.HOVER_VIEW_DOCUMENTS, lang.script(fmt, 'pdf-' .. name))
6376
end
6477

0 commit comments

Comments
 (0)