@@ -1216,23 +1216,19 @@ namespace ts.server {
1216
1216
}
1217
1217
}
1218
1218
1219
- private getCompletionEntryDetails ( args : protocol . CompletionDetailsRequestArgs ) : ReadonlyArray < protocol . CompletionEntryDetails > {
1219
+ private getCompletionEntryDetails ( args : protocol . CompletionDetailsRequestArgs , simplifiedResult : boolean ) : ReadonlyArray < protocol . CompletionEntryDetails > | ReadonlyArray < CompletionEntryDetails > {
1220
1220
const { file, project } = this . getFileAndProject ( args ) ;
1221
1221
const scriptInfo = this . projectService . getScriptInfoForNormalizedPath ( file ) ;
1222
1222
const position = this . getPosition ( args , scriptInfo ) ;
1223
1223
const formattingOptions = project . projectService . getFormatCodeOptions ( file ) ;
1224
1224
1225
- return mapDefined < string | protocol . CompletionEntryIdentifier , protocol . CompletionEntryDetails > ( args . entryNames , entryName => {
1225
+ const result = mapDefined ( args . entryNames , entryName => {
1226
1226
const { name, source } = typeof entryName === "string" ? { name : entryName , source : undefined } : entryName ;
1227
- const details = project . getLanguageService ( ) . getCompletionEntryDetails ( file , position , name , formattingOptions , source ) ;
1228
- if ( details ) {
1229
- const mappedCodeActions = map ( details . codeActions , action => this . mapCodeAction ( action , scriptInfo ) ) ;
1230
- return { ...details , codeActions : mappedCodeActions } ;
1231
- }
1232
- else {
1233
- return undefined ;
1234
- }
1227
+ return project . getLanguageService ( ) . getCompletionEntryDetails ( file , position , name , formattingOptions , source ) ;
1235
1228
} ) ;
1229
+ return simplifiedResult
1230
+ ? result . map ( details => ( { ...details , codeActions : map ( details . codeActions , action => this . mapCodeAction ( action , scriptInfo ) ) } ) )
1231
+ : result ;
1236
1232
}
1237
1233
1238
1234
private getCompileOnSaveAffectedFileList ( args : protocol . FileRequestArgs ) : ReadonlyArray < protocol . CompileOnSaveAffectedFileListSingleProject > {
@@ -1842,7 +1838,10 @@ namespace ts.server {
1842
1838
return this . requiredResponse ( this . getCompletions ( request . arguments , /*simplifiedResult*/ false ) ) ;
1843
1839
} ,
1844
1840
[ CommandNames . CompletionDetails ] : ( request : protocol . CompletionDetailsRequest ) => {
1845
- return this . requiredResponse ( this . getCompletionEntryDetails ( request . arguments ) ) ;
1841
+ return this . requiredResponse ( this . getCompletionEntryDetails ( request . arguments , /*simplifiedResult*/ true ) ) ;
1842
+ } ,
1843
+ [ CommandNames . CompletionDetailsFull ] : ( request : protocol . CompletionDetailsRequest ) => {
1844
+ return this . requiredResponse ( this . getCompletionEntryDetails ( request . arguments , /*simplifiedResult*/ false ) ) ;
1846
1845
} ,
1847
1846
[ CommandNames . CompileOnSaveAffectedFileList ] : ( request : protocol . CompileOnSaveAffectedFileListRequest ) => {
1848
1847
return this . requiredResponse ( this . getCompileOnSaveAffectedFileList ( request . arguments ) ) ;
0 commit comments