@@ -76,36 +76,38 @@ function registerDebuggers() {
76
76
context . subscriptions . push ( vscode . debug . registerDebugAdapterDescriptorFactory ( 'emmylua_attach' , factory ) ) ;
77
77
context . subscriptions . push ( vscode . debug . registerDebugAdapterDescriptorFactory ( 'emmylua_launch' , factory ) ) ;
78
78
}
79
- context . subscriptions . push ( vscode . languages . registerInlineValuesProvider ( 'lua' , {
80
- // 不知道是否应该发到ls上再做处理
81
- // 先简单处理一下吧
82
- provideInlineValues ( document : vscode . TextDocument , viewport : vscode . Range , context : vscode . InlineValueContext ) : vscode . ProviderResult < vscode . InlineValue [ ] > {
79
+ if ( ! ctx . newLanguageServer ) {
80
+ context . subscriptions . push ( vscode . languages . registerInlineValuesProvider ( 'lua' , {
81
+ // 不知道是否应该发到ls上再做处理
82
+ // 先简单处理一下吧
83
+ provideInlineValues ( document : vscode . TextDocument , viewport : vscode . Range , context : vscode . InlineValueContext ) : vscode . ProviderResult < vscode . InlineValue [ ] > {
83
84
84
- const allValues : vscode . InlineValue [ ] = [ ] ;
85
- const regExps = [
86
- / (?< = l o c a l \s + ) [ ^ \s , \< ] + / ,
87
- / (?< = - - - @ p a r a m \s + ) \S + /
88
- ]
85
+ const allValues : vscode . InlineValue [ ] = [ ] ;
86
+ const regExps = [
87
+ / (?< = l o c a l \s + ) [ ^ \s , \< ] + / ,
88
+ / (?< = - - - @ p a r a m \s + ) \S + /
89
+ ]
89
90
90
- for ( let l = viewport . start . line ; l <= context . stoppedLocation . end . line ; l ++ ) {
91
- const line = document . lineAt ( l ) ;
91
+ for ( let l = viewport . start . line ; l <= context . stoppedLocation . end . line ; l ++ ) {
92
+ const line = document . lineAt ( l ) ;
92
93
93
- for ( const regExp of regExps ) {
94
- const match = regExp . exec ( line . text ) ;
95
- if ( match ) {
96
- const varName = match [ 0 ] ;
97
- const varRange = new vscode . Range ( l , match . index , l , match . index + varName . length ) ;
98
- // value found via variable lookup
99
- allValues . push ( new vscode . InlineValueVariableLookup ( varRange , varName , false ) ) ;
100
- break ;
94
+ for ( const regExp of regExps ) {
95
+ const match = regExp . exec ( line . text ) ;
96
+ if ( match ) {
97
+ const varName = match [ 0 ] ;
98
+ const varRange = new vscode . Range ( l , match . index , l , match . index + varName . length ) ;
99
+ // value found via variable lookup
100
+ allValues . push ( new vscode . InlineValueVariableLookup ( varRange , varName , false ) ) ;
101
+ break ;
102
+ }
101
103
}
104
+
102
105
}
103
106
107
+ return allValues ;
104
108
}
105
-
106
- return allValues ;
107
- }
108
- } ) ) ;
109
+ } ) ) ;
110
+ }
109
111
}
110
112
111
113
function onDidChangeTextDocument ( event : vscode . TextDocumentChangeEvent ) {
0 commit comments