@@ -77,7 +77,9 @@ const LuaSymbolKind = {
7777 table : 'table' ,
7878 class : 'class' ,
7979 module : 'module' ,
80- function : 'function'
80+ function : 'function' ,
81+ thread : 'thread' ,
82+ userdata : 'userdata'
8183}
8284
8385exports . LuaSymbolKind = LuaSymbolKind ;
@@ -143,6 +145,8 @@ const LuaTypes = {
143145 table : 'table' ,
144146 function : 'function' ,
145147 module : 'module' ,
148+ thread : 'thread' ,
149+ userdata : 'userdata' ,
146150 lazy : 'lazy'
147151}
148152
@@ -178,6 +182,22 @@ class LuaString extends LuaTypeBase {
178182
179183exports . LuaString = LuaString ;
180184
185+ class LuaThread extends LuaTypeBase {
186+ constructor ( ) {
187+ super ( LuaTypes . thread ) ;
188+ }
189+ }
190+
191+ exports . LuaThread = LuaThread ;
192+
193+ class LuaUserData extends LuaTypeBase {
194+ constructor ( ) {
195+ super ( LuaTypes . userdata ) ;
196+ }
197+ }
198+
199+ exports . LuaUserData = LuaUserData ;
200+
181201class LuaAny extends LuaTypeBase {
182202 constructor ( ) {
183203 super ( LuaTypes . any ) ;
@@ -190,6 +210,8 @@ const LuaBasicTypes = {
190210 number : new LuaNumber ( ) ,
191211 boolean : new LuaBoolean ( ) ,
192212 string : new LuaString ( ) ,
213+ thread : new LuaThread ( ) ,
214+ userdata : new LuaUserData ( ) ,
193215 any : new LuaAny ( )
194216} ;
195217
@@ -214,6 +236,54 @@ class SearchResult {
214236SearchResult . null = new SearchResult ( ) ;
215237exports . SearchResult = SearchResult ;
216238
239+ class TypeGroup {
240+ constructor ( ) {
241+ this . symbols = [ ] ;
242+ }
243+
244+ has ( predictor ) {
245+ return this . indexOf ( predictor ) < this . symbols . length ;
246+ }
247+
248+ indexOf ( predictor ) {
249+ const length = this . symbol . length ;
250+ for ( let i = 0 ; i < length ; i ++ ) {
251+ const symbol = this . symbols [ i ] ;
252+ if ( predictor ( symbol ) ) {
253+ return i ;
254+ }
255+ }
256+ return length ;
257+ }
258+
259+ add ( symbol ) {
260+ const index = this . indexOf ( s => s . uri === symbol . uri ) ;
261+ delete this . symbols [ index ] ;
262+ this . symbols [ index ] = symbol ;
263+ return index ;
264+ }
265+
266+ del ( symbol ) {
267+ const index = this . indexOf ( s => s . uri === symbol . uri ) ;
268+ delete this . symbols . splice ( index , 1 ) [ 0 ] ;
269+ }
270+
271+ get ( name , modulePath ) {
272+ const symbols = [ ] ;
273+ this . symbols . forEach ( symbol => {
274+ if ( ! symbol . uri || symbol . uri . includes ( modulePath ) ) {
275+ if ( symbol . type instanceof LuaTable ) {
276+ let field = symbol . get ( name ) ;
277+ field && symbols . push ( field ) ;
278+ }
279+ }
280+ } ) ;
281+ return symbols ;
282+ }
283+ }
284+
285+ exports . TypeGroup = TypeGroup ;
286+
217287class LuaTable extends LuaTypeBase {
218288 constructor ( metatable ) {
219289 super ( LuaTypes . table ) ;
0 commit comments