Skip to content

Commit 2c79870

Browse files
authored
Merge branch 'master' into cast-table-to-class
2 parents abd5daa + b71cb7a commit 2c79870

File tree

32 files changed

+952
-483
lines changed

32 files changed

+952
-483
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: Report LuaLS.github.io issues
4+
url: https://github.com/LuaLS/LuaLS.github.io/issues
5+
about: Please report issues regarding our website (and the documentation on it) in the website repository.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Documentation Report
2+
description: Report an issue with documentation in the lua-language-server.
3+
labels:
4+
- documentation
5+
assignees:
6+
- carsakiller
7+
body:
8+
- type: markdown
9+
attributes:
10+
value: >
11+
For issues with our [website](https://luals.github.io) and its wiki,
12+
please visit the [correct repository](https://github.com/LuaLS/LuaLS.github.io/issues).
13+
- type: markdown
14+
attributes:
15+
value: >
16+
**Please check for similar issues before continuing!**
17+
- type: textarea
18+
id: expected
19+
attributes:
20+
label: Issue Description
21+
description: Please describe the documentation issue. Is something incorrect, missing or improveable?
22+
validations:
23+
required: true
24+
- type: textarea
25+
id: additional-notes
26+
attributes:
27+
label: Additional Notes
28+
description: >
29+
Please provide any additional notes, context,
30+
and media you have.
31+
- type: markdown
32+
attributes:
33+
value: |
34+
Thank you very much for helping improve the language server! ❤️

changelog.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,44 @@
22

33
## Unreleased
44
<!-- Add all new changes here. They will be moved under a version at release -->
5+
* `NEW` Add matching checks between the shape of tables and classes, during type checking. [#2768](https://github.com/LuaLS/lua-language-server/pull/2768
6+
* `FIX` Error `attempt to index a nil value` when `Lua.hint.semicolon == 'All'` [#2788](https://github.com/LuaLS/lua-language-server/issues/2788)
7+
8+
## 3.10.3
9+
`2024-8-8`
10+
* `FIX` Memory leak with `---@enum(partical)`
11+
12+
## 3.10.2
13+
`2024-8-7`
14+
* `NEW` Add support for binary metamethod on right operand [#2777](https://github.com/LuaLS/lua-language-server/pull/2777)
15+
* `FIX` Incorrect indentation fixing in some case
16+
17+
## 3.10.1
18+
`2024-8-2`
19+
* `FIX` Runtime error
20+
* `FIX` Disable indentation fixing for Non-VSCode
21+
22+
## 3.10.0
23+
`2024-8-1`
524
* `NEW` Add postfix snippet for `unpack`
6-
* `FIX` `diagnostics.severity` defaulting to "Warning" when run using `--check` [#2730](https://github.com/LuaLS/lua-language-server/issues/2730)
725
* `NEW` Add support for lambda style functions, `|paramList| expr` is syntactic sugar for `function(paramList) return expr end`
8-
* `FIX` Respect `completion.showParams` config for local function completion
26+
* `NEW` Added lua regular expression support for `Lua.doc.<scope>Name` [#2753](https://github.com/LuaLS/lua-language-server/pull/2753)
27+
* `NEW` You can now click on "References" in CodeLen to display the reference list(VSCode)
28+
* `NEW` Improved behavior for inserting new lines:
29+
+ When inside an annotation, an annotation tag will be added at the beginning of the line (VSCode).
30+
+ When between `function () end` or similar constructs, the format will be adjusted to a more reasonable one (VSCode) and leading/trailing spaces will be removed (generic).
31+
+ Attempts to semantically fix improper indentation (generic).
932
* `CHG` Improve performance of multithreaded `--check` and `undefined-field` diagnostic
33+
* `CHG` Change spacing of parameter inlay hints to match other LSPs, like `rust-analyzer`
34+
* `FIX` `diagnostics.severity` defaulting to "Warning" when run using `--check` [#2730](https://github.com/LuaLS/lua-language-server/issues/2730)
35+
* `FIX` Respect `completion.showParams` config for local function completion
1036
* `FIX` Addons can now self-recommend as expected. Fixed by correcting the `wholeMatch` function
1137
* `FIX` Now correctly evaluates the visibility of fields in a class when they are defined directly in the object. use for completion and invisible dianostic. [#2752](https://github.com/LuaLS/lua-language-server/issues/2752)
12-
* `NEW` added lua regular expression support for Lua.doc.<scope>Name [#2753](https://github.com/LuaLS/lua-language-server/pull/2753)
1338
* `FIX` Bad triggering of the `inject-field` diagnostic, when the fields are declared at the creation of the object [#2746](https://github.com/LuaLS/lua-language-server/issues/2746)
14-
* `CHG` Change spacing of parameter inlay hints to match other LSPs, like `rust-analyzer`
1539
* `FIX` Inconsistent type narrow behavior of function call args [#2758](https://github.com/LuaLS/lua-language-server/issues/2758)
16-
* `NEW` Add matching checks between the shape of tables and classes, during type checking. [#2768](https://github.com/LuaLS/lua-language-server/pull/2768
40+
* `FIX` Improve the `missing-fields` logic to be able to correctly handle classes defined several times [#22770](https://github.com/LuaLS/lua-language-server/pull/2770)
41+
* `FIX` Typos in annotation descriptions
42+
* `FIX` incorrect `CompletionItemKind` for postfix snippets [#2773](https://github.com/LuaLS/lua-language-server/pull/2773)
1743

1844
## 3.9.3
1945
`2024-6-11`

locale/en-us/script.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ Provide type declaration for [operator metamethods](http://lua-users.org/wiki/Me
11671167
### Vector Add Metamethod
11681168
```
11691169
---@class Vector
1170-
---@operation add(Vector):Vector
1170+
---@operator add(Vector):Vector
11711171
11721172
vA = Vector.new(1, 2, 3)
11731173
vB = Vector.new(10, 20, 30)
@@ -1178,7 +1178,7 @@ vC = vA + vB
11781178
### Unary Minus
11791179
```
11801180
---@class Passcode
1181-
---@operation unm:integer
1181+
---@operator unm:integer
11821182
11831183
pA = Passcode.new(1234)
11841184
pB = -pA

locale/pt-br/script.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ Provide type declaration for [operator metamethods](http://lua-users.org/wiki/Me
11671167
### Vector Add Metamethod
11681168
```
11691169
---@class Vector
1170-
---@operation add(Vector):Vector
1170+
---@operator add(Vector):Vector
11711171
11721172
vA = Vector.new(1, 2, 3)
11731173
vB = Vector.new(10, 20, 30)
@@ -1178,7 +1178,7 @@ vC = vA + vB
11781178
### Unary Minus
11791179
```
11801180
---@class Passcode
1181-
---@operation unm:integer
1181+
---@operator unm:integer
11821182
11831183
pA = Passcode.new(1234)
11841184
pB = -pA
@@ -1216,7 +1216,7 @@ setColor(colors.green)
12161216
LUADOC_DESC_SOURCE = -- TODO: need translate!
12171217
[=[
12181218
Provide a reference to some source code which lives in another file. When
1219-
searching for the defintion of an item, its `@source` will be used.
1219+
searching for the definition of an item, its `@source` will be used.
12201220
12211221
## Syntax
12221222
`@source <path>`
@@ -1264,7 +1264,7 @@ end
12641264
LUADOC_DESC_PRIVATE = -- TODO: need translate!
12651265
[=[
12661266
Mark a function as private to a @class. Private functions can be accessed only
1267-
from within their class and are not accessable from child classes.
1267+
from within their class and are not accessible from child classes.
12681268
12691269
## Syntax
12701270
`@private`

locale/zh-cn/script.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ Provide type declaration for [operator metamethods](http://lua-users.org/wiki/Me
11671167
### Vector Add Metamethod
11681168
```
11691169
---@class Vector
1170-
---@operation add(Vector):Vector
1170+
---@operator add(Vector):Vector
11711171
11721172
vA = Vector.new(1, 2, 3)
11731173
vB = Vector.new(10, 20, 30)
@@ -1178,7 +1178,7 @@ vC = vA + vB
11781178
### Unary Minus
11791179
```
11801180
---@class Passcode
1181-
---@operation unm:integer
1181+
---@operator unm:integer
11821182
11831183
pA = Passcode.new(1234)
11841184
pB = -pA
@@ -1216,7 +1216,7 @@ setColor(colors.green)
12161216
LUADOC_DESC_SOURCE = -- TODO: need translate!
12171217
[=[
12181218
Provide a reference to some source code which lives in another file. When
1219-
searching for the defintion of an item, its `@source` will be used.
1219+
searching for the definition of an item, its `@source` will be used.
12201220
12211221
## Syntax
12221222
`@source <path>`
@@ -1264,7 +1264,7 @@ end
12641264
LUADOC_DESC_PRIVATE = -- TODO: need translate!
12651265
[=[
12661266
Mark a function as private to a @class. Private functions can be accessed only
1267-
from within their class and are not accessable from child classes.
1267+
from within their class and are not accessible from child classes.
12681268
12691269
## Syntax
12701270
`@private`

locale/zh-tw/script.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ Provide type declaration for [operator metamethods](http://lua-users.org/wiki/Me
11611161
### Vector Add Metamethod
11621162
```
11631163
---@class Vector
1164-
---@operation add(Vector):Vector
1164+
---@operator add(Vector):Vector
11651165
11661166
vA = Vector.new(1, 2, 3)
11671167
vB = Vector.new(10, 20, 30)
@@ -1172,7 +1172,7 @@ vC = vA + vB
11721172
### Unary Minus
11731173
```
11741174
---@class Passcode
1175-
---@operation unm:integer
1175+
---@operator unm:integer
11761176
11771177
pA = Passcode.new(1234)
11781178
pB = -pA
@@ -1210,7 +1210,7 @@ setColor(colors.green)
12101210
LUADOC_DESC_SOURCE = -- TODO: need translate!
12111211
[=[
12121212
Provide a reference to some source code which lives in another file. When
1213-
searching for the defintion of an item, its `@source` will be used.
1213+
searching for the definition of an item, its `@source` will be used.
12141214
12151215
## Syntax
12161216
`@source <path>`
@@ -1258,7 +1258,7 @@ end
12581258
LUADOC_DESC_PRIVATE = -- TODO: need translate!
12591259
[=[
12601260
Mark a function as private to a @class. Private functions can be accessed only
1261-
from within their class and are not accessable from child classes.
1261+
from within their class and are not accessible from child classes.
12621262
12631263
## Syntax
12641264
`@private`

script/cli/check.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ local util = require 'utility'
88

99
local numThreads = tonumber(NUM_THREADS or 1)
1010

11-
local exe = arg[-1]
11+
local exe
12+
local minIndex = -1
13+
while arg[minIndex] do
14+
exe = arg[minIndex]
15+
minIndex = minIndex - 1
16+
end
1217
-- TODO: is this necessary? got it from the shell.lua helper in bee.lua tests
1318
if platform.os == 'windows' and not exe:match('%.[eE][xX][eE]$') then
1419
exe = exe..'.exe'

script/core/code-lens.lua

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ local await = require 'await'
44
local conv = require 'proto.converter'
55
local getRef = require 'core.reference'
66
local lang = require 'language'
7+
local client = require 'client'
78

89
---@class parser.state
910
---@field package _codeLens? codeLens
@@ -88,12 +89,35 @@ end
8889
function mt:resolveReference(source)
8990
local refs = getRef(self.uri, source.finish, false)
9091
local count = refs and #refs or 0
91-
local command = conv.command(
92-
lang.script('COMMAND_REFERENCE_COUNT', count),
93-
'',
94-
{}
95-
)
96-
return command
92+
if client.getOption('codeLensViewReferences') then
93+
local locations = {}
94+
for _, ref in ipairs(refs or {}) do
95+
local state = files.getState(ref.uri)
96+
if state then
97+
locations[#locations+1] = conv.location(
98+
ref.uri,
99+
conv.packRange(state, ref.target.start, ref.target.finish)
100+
)
101+
end
102+
end
103+
local command = conv.command(
104+
lang.script('COMMAND_REFERENCE_COUNT', count),
105+
'lua.showReferences',
106+
{
107+
self.uri,
108+
conv.packPosition(self.state, source.start),
109+
locations,
110+
}
111+
)
112+
return command
113+
else
114+
local command = conv.command(
115+
lang.script('COMMAND_REFERENCE_COUNT', count),
116+
'',
117+
{}
118+
)
119+
return command
120+
end
97121
end
98122

99123
---@async

script/core/completion/postfix.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ local function checkPostFix(state, word, wordPosition, position, symbol, results
353353
end):gsub('%$%{?%d+%}?', '')
354354
results[#results+1] = {
355355
label = action.key,
356-
kind = define.CompletionItemKind.Event,
356+
kind = define.CompletionItemKind.Snippet,
357357
description = markdown()
358358
: add('lua', descText)
359359
: string(),

0 commit comments

Comments
 (0)