@@ -15,16 +15,7 @@ local Care = util.switch()
1515 : case ' setglobal'
1616 : call (function (source , options , results )
1717 local isLib = vm .isGlobalLibraryName (source [1 ])
18- local isFunc = false
19- local value = source .value
20-
21- if value and value .type == ' function' then
22- isFunc = true
23- elseif source .parent .type == ' call' then
24- isFunc = true
25- elseif options .isEnhanced then
26- isFunc = infer .hasType (source , ' function' )
27- end
18+ local isFunc = infer .hasType (source , ' function' )
2819
2920 local type = isFunc and define .TokenTypes [' function' ] or define .TokenTypes .variable
3021 local modifier = isLib and define .TokenModifiers .defaultLibrary or define .TokenModifiers .static
@@ -67,7 +58,7 @@ local Care = util.switch()
6758 return
6859 end
6960 end
70- if options . isEnhanced and infer .hasType (source , ' function' ) then
61+ if infer .hasType (source , ' function' ) then
7162 results [# results + 1 ] = {
7263 start = source .start ,
7364 finish = source .finish ,
@@ -157,7 +148,7 @@ local Care = util.switch()
157148 return
158149 end
159150 -- 5. References to other functions
160- if options . isEnhanced and infer .hasType (loc , ' function' ) then
151+ if infer .hasType (loc , ' function' ) then
161152 results [# results + 1 ] = {
162153 start = source .start ,
163154 finish = source .finish ,
@@ -167,40 +158,18 @@ local Care = util.switch()
167158 return
168159 end
169160 -- 6. Class declaration
170- if options .isEnhanced then
171- -- search all defs
172- for _ , def in ipairs (vm .getDefs (source )) do
173- if def .bindDocs then
174- for _ , doc in ipairs (def .bindDocs ) do
175- if doc .type == " doc.class" and doc .bindSources then
176- for _ , src in ipairs (doc .bindSources ) do
177- if src == def then
178- results [# results + 1 ] = {
179- start = source .start ,
180- finish = source .finish ,
181- type = define .TokenTypes .class ,
182- }
183- return
184- end
185- end
186- end
187- end
188- end
189- end
190- else
191161 -- only search this local
192- if loc .bindDocs then
193- for i , doc in ipairs (loc .bindDocs ) do
194- if doc .type == " doc.class" and doc .bindSources then
195- for _ , src in ipairs (doc .bindSources ) do
196- if src == loc then
197- results [# results + 1 ] = {
198- start = source .start ,
199- finish = source .finish ,
200- type = define .TokenTypes .class ,
201- }
202- return
203- end
162+ if loc .bindDocs then
163+ for i , doc in ipairs (loc .bindDocs ) do
164+ if doc .type == " doc.class" and doc .bindSources then
165+ for _ , src in ipairs (doc .bindSources ) do
166+ if src == loc then
167+ results [# results + 1 ] = {
168+ start = source .start ,
169+ finish = source .finish ,
170+ type = define .TokenTypes .class ,
171+ }
172+ return
204173 end
205174 end
206175 end
708677
709678--- @async
710679return function (uri , start , finish )
711- if config .get (uri , ' Lua.color.mode ' ) == ' Grammar ' then
680+ if not config .get (uri , ' Lua.semantic.enable ' ) then
712681 return nil
713682 end
714683 local state = files .getState (uri )
@@ -720,7 +689,6 @@ return function (uri, start, finish)
720689 uri = uri ,
721690 state = state ,
722691 text = files .getText (uri ),
723- isEnhanced = config .get (uri , ' Lua.color.mode' ) == ' SemanticEnhanced' ,
724692 }
725693
726694 local results = {}
0 commit comments