File tree Expand file tree Collapse file tree 6 files changed +16
-6
lines changed
Expand file tree Collapse file tree 6 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ server will generate `doc.json` and `doc.md` in `LOGPATH`.
9393 end
9494 end
9595 ```
96+ * ` CHG ` find reference: respect ` includeDeclaration ` (although I don't know how to turn off this option in VSCode)
9697* ` FIX ` [ #1567 ]
9798* ` FIX ` [ #1593 ]
9899* ` FIX ` [ #1595 ]
Original file line number Diff line number Diff line change @@ -55,7 +55,10 @@ local accept = {
5555}
5656
5757--- @async
58- return function (uri , position )
58+ --- @param uri uri
59+ --- @param position integer
60+ --- @param includeDeclaration boolean
61+ return function (uri , position , includeDeclaration )
5962 local ast = files .getState (uri )
6063 if not ast then
6164 return nil
@@ -82,6 +85,9 @@ return function (uri, position)
8285 if src .type == ' self' then
8386 goto CONTINUE
8487 end
88+ if not includeDeclaration and guide .isSet (src ) then
89+ goto CONTINUE
90+ end
8591 src = src .field or src .method or src
8692 if src .type == ' getindex'
8793 or src .type == ' setindex'
Original file line number Diff line number Diff line change @@ -484,7 +484,7 @@ m.register 'textDocument/references' {
484484 end
485485 local core = require ' core.reference'
486486 local pos = converter .unpackPosition (state , params .position )
487- local result = core (uri , pos )
487+ local result = core (uri , pos , params . context . includeDeclaration )
488488 if not result then
489489 return nil
490490 end
Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ vm.binarySwitch = util.switch()
273273 or op == ' //' and a // b
274274 or op == ' ^' and a ^ b
275275 vm .setNode (source , {
276- type = math.type (result ) == ' integer' and ' integer' or ' number' ,
276+ type = ( op == ' // ' or math.type (result ) == ' integer' ) and ' integer' or ' number' ,
277277 start = source .start ,
278278 finish = source .finish ,
279279 parent = source ,
@@ -288,7 +288,6 @@ vm.binarySwitch = util.switch()
288288 if op == ' +'
289289 or op == ' -'
290290 or op == ' *'
291- or op == ' //'
292291 or op == ' %' then
293292 local uri = guide .getUri (source )
294293 local infer1 = vm .getInfer (source [1 ])
@@ -302,6 +301,10 @@ vm.binarySwitch = util.switch()
302301 end
303302 end
304303 end
304+ if op == ' //' then
305+ vm .setNode (source , node or vm .declareGlobal (' type' , ' integer' ))
306+ return
307+ end
305308 vm .setNode (source , node or vm .declareGlobal (' type' , ' number' ))
306309 end
307310 end )
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ function TEST(datas)
8383 end
8484
8585 local sourcePos = (sourceList [1 ][1 ] + sourceList [1 ][2 ]) // 2
86- local positions = core (sourceUri , sourcePos )
86+ local positions = core (sourceUri , sourcePos , true )
8787 if positions then
8888 local result = {}
8989 for i , position in ipairs (positions ) do
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ function TEST(script)
2525
2626 local input = catched [' ?' ] + catched [' ~' ]
2727 local expect = catched [' !' ] + catched [' ~' ]
28- local results = core (TESTURI , input [1 ][1 ])
28+ local results = core (TESTURI , input [1 ][1 ], true )
2929 if results then
3030 local positions = {}
3131 for i , result in ipairs (results ) do
You can’t perform that action at this time.
0 commit comments