File tree 1 file changed +18
-16
lines changed
1 file changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -172,26 +172,28 @@ export default class BashServer {
172
172
return [ ...symbolCompletions , ...programCompletions , ...builtinsCompletions ]
173
173
}
174
174
175
- private onCompletionResolve ( item : LSP . CompletionItem ) : Promise < LSP . CompletionItem > {
176
- // TODO: async await would be nice I guess
177
- if ( item . data . type === 'executable' ) {
178
- return this . executables
179
- . documentation ( item . data . name )
180
- . then ( doc => ( {
175
+ private async onCompletionResolve (
176
+ item : LSP . CompletionItem ,
177
+ ) : Promise < LSP . CompletionItem > {
178
+ const { data : { name, type } } = item
179
+ try {
180
+ if ( type === 'executable' ) {
181
+ const doc = await this . executables . documentation ( name )
182
+ return {
181
183
...item ,
182
184
detail : doc ,
183
- } ) )
184
- . catch ( ( ) => item )
185
- } else if ( item . data . type === 'builtin' ) {
186
- //
187
- return Builtins . documentation ( item . data . name )
188
- . then ( doc => ( {
185
+ }
186
+ } else if ( type === 'builtin' ) {
187
+ const doc = await Builtins . documentation ( name )
188
+ return {
189
189
...item ,
190
190
detail : doc ,
191
- } ) )
192
- . catch ( ( ) => item )
193
- } else {
194
- return Promise . resolve ( item )
191
+ }
192
+ } else {
193
+ return item
194
+ }
195
+ } catch ( error ) {
196
+ return item
195
197
}
196
198
}
197
199
}
You can’t perform that action at this time.
0 commit comments