@@ -1216,23 +1216,19 @@ namespace ts.server {
12161216 }
12171217 }
12181218
1219- private getCompletionEntryDetails ( args : protocol . CompletionDetailsRequestArgs ) : ReadonlyArray < protocol . CompletionEntryDetails > {
1219+ private getCompletionEntryDetails ( args : protocol . CompletionDetailsRequestArgs , simplifiedResult : boolean ) : ReadonlyArray < protocol . CompletionEntryDetails > | ReadonlyArray < CompletionEntryDetails > {
12201220 const { file, project } = this . getFileAndProject ( args ) ;
12211221 const scriptInfo = this . projectService . getScriptInfoForNormalizedPath ( file ) ;
12221222 const position = this . getPosition ( args , scriptInfo ) ;
12231223 const formattingOptions = project . projectService . getFormatCodeOptions ( file ) ;
12241224
1225- return mapDefined < string | protocol . CompletionEntryIdentifier , protocol . CompletionEntryDetails > ( args . entryNames , entryName => {
1225+ const result = mapDefined ( args . entryNames , entryName => {
12261226 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 ) ;
12351228 } ) ;
1229+ return simplifiedResult
1230+ ? result . map ( details => ( { ...details , codeActions : map ( details . codeActions , action => this . mapCodeAction ( action , scriptInfo ) ) } ) )
1231+ : result ;
12361232 }
12371233
12381234 private getCompileOnSaveAffectedFileList ( args : protocol . FileRequestArgs ) : ReadonlyArray < protocol . CompileOnSaveAffectedFileListSingleProject > {
@@ -1842,7 +1838,10 @@ namespace ts.server {
18421838 return this . requiredResponse ( this . getCompletions ( request . arguments , /*simplifiedResult*/ false ) ) ;
18431839 } ,
18441840 [ 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 ) ) ;
18461845 } ,
18471846 [ CommandNames . CompileOnSaveAffectedFileList ] : ( request : protocol . CompileOnSaveAffectedFileListRequest ) => {
18481847 return this . requiredResponse ( this . getCompileOnSaveAffectedFileList ( request . arguments ) ) ;
0 commit comments