diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-28 21:23:33 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-28 21:23:33 +0800 |
commit | 2793fe8003d10c5d7db54a63f3e6140ce305fb92 (patch) | |
tree | 5e460fa481c6c7649f439e70938d42b2354dce0c /server | |
parent | ef4df9c2b854808e2fa1280e383c5e4213d66a28 (diff) | |
download | lua-language-server-2793fe8003d10c5d7db54a63f3e6140ce305fb92.zip |
definition会找到定义者自己
Diffstat (limited to 'server')
-rw-r--r-- | server/src/core/definition.lua | 5 | ||||
-rw-r--r-- | server/test/crossfile/definition.lua | 23 | ||||
-rw-r--r-- | server/test/definition/bug.lua | 2 | ||||
-rw-r--r-- | server/test/definition/emmy.lua | 2 | ||||
-rw-r--r-- | server/test/definition/local.lua | 4 |
5 files changed, 22 insertions, 14 deletions
diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua index fd5b4758..4ed70bc4 100644 --- a/server/src/core/definition.lua +++ b/server/src/core/definition.lua @@ -207,11 +207,6 @@ local function makeList(source) local list = {} local mark = {} return list, function (src) - if Mode == 'definition' then - if source == src then - return - end - end if mark[src] then return end diff --git a/server/test/crossfile/definition.lua b/server/test/crossfile/definition.lua index 06512f9b..9de93c92 100644 --- a/server/test/crossfile/definition.lua +++ b/server/test/crossfile/definition.lua @@ -117,6 +117,7 @@ TEST { { path = 'b.lua', content = 'local <?t?> = require "a"', + target = {7, 7}, }, } @@ -140,6 +141,7 @@ TEST { { path = 'b.lua', content = 'local <?t?> = require "a"', + target = {7, 7}, }, } @@ -209,6 +211,7 @@ TEST { content = [[ local <?t?> = require 'a' ]], + target = {19, 19}, }, } @@ -310,8 +313,9 @@ TEST { { path = 'b.lua', content = [[ - local <?t?> = require 'a' - ]] + local <!t!> = require 'a' + <?t?> + ]], } } @@ -331,7 +335,8 @@ TEST { { path = 'c.lua', content = [[ - local <?f?> = require 'a' + local <!f!> = require 'a' + <?f?> ]] } } @@ -354,7 +359,8 @@ TEST { { path = 'c.lua', content = [[ - local <?f?> = require 'a' + local <!f!> = require 'a' + <?f?> ]] } } @@ -369,7 +375,8 @@ TEST { { path = 'b/xxx.lua', content = [[ - local <?f?> = require 'xxx' + local <!f!> = require 'xxx' + <?f?> return function () end ]] } @@ -387,7 +394,8 @@ TEST { path = 'b.lua', content = [[ ---@type Class - local <?obj?> + local <!obj!> + <?obj?> ]] }, } @@ -397,7 +405,8 @@ TEST { path = 'a.lua', content = [[ ---@type Class - local <?obj?> + local <!obj!> + <?obj?> ]] }, { diff --git a/server/test/definition/bug.lua b/server/test/definition/bug.lua index ee414ef6..1d3ab02c 100644 --- a/server/test/definition/bug.lua +++ b/server/test/definition/bug.lua @@ -86,5 +86,5 @@ return f(), <?b?> TEST [[ local a = os.clock() -local <?b?> = os.clock() +local <?<!b!>?> = os.clock() ]] diff --git a/server/test/definition/emmy.lua b/server/test/definition/emmy.lua index ef7c1773..fde1fe17 100644 --- a/server/test/definition/emmy.lua +++ b/server/test/definition/emmy.lua @@ -32,7 +32,7 @@ local <!obj!> TEST [[ ---@type A -local <?obj?> +local <?<!obj!>?> ---@class A local <!mt!> diff --git a/server/test/definition/local.lua b/server/test/definition/local.lua index f4744799..4153bfa0 100644 --- a/server/test/definition/local.lua +++ b/server/test/definition/local.lua @@ -189,3 +189,7 @@ local x = function () <?x?>() end ]] + +TEST [[ +local <?<!x!>?> +]] |