@@ -795,7 +795,7 @@ export interface Client {
795795 handleRemoveCodeAnalysisProblems ( refreshSquigglesOnSave : boolean , identifiersAndUris : CodeAnalysisDiagnosticIdentifiersAndUri [ ] ) : Promise < void > ;
796796 handleFixCodeAnalysisProblems ( workspaceEdit : vscode . WorkspaceEdit , refreshSquigglesOnSave : boolean , identifiersAndUris : CodeAnalysisDiagnosticIdentifiersAndUri [ ] ) : Promise < void > ;
797797 handleDisableAllTypeCodeAnalysisProblems ( code : string , identifiersAndUris : CodeAnalysisDiagnosticIdentifiersAndUri [ ] ) : Promise < void > ;
798- handleCreateDeclarationOrDefinition ( copy ? : boolean ) : Promise < void > ;
798+ handleCreateDeclarationOrDefinition ( isCopyToClipboard : boolean , codeActionRange ?: Range ) : Promise < void > ;
799799 onInterval ( ) : void ;
800800 dispose ( ) : void ;
801801 addFileAssociations ( fileAssociations : string , languageId : string ) : void ;
@@ -1856,9 +1856,11 @@ export class DefaultClient implements Client {
18561856 if ( ! currentProvider . isReady ) {
18571857 return ;
18581858 }
1859+
18591860 await Promise . all ( [
18601861 this . clearCustomConfigurations ( ) ,
1861- this . handleRemoveAllCodeAnalysisProblems ( ) ,
1862+ this . handleRemoveAllCodeAnalysisProblems ( ) ] ) ;
1863+ await Promise . all ( [
18621864 ...[ ...this . trackedDocuments ] . map ( document => this . provideCustomConfiguration ( document . uri , undefined , true ) )
18631865 ] ) ;
18641866 }
@@ -1924,7 +1926,7 @@ export class DefaultClient implements Client {
19241926 hasCompleted = true ;
19251927 this . sendCustomBrowseConfiguration ( null , undefined , Version . v0 , true ) ;
19261928 if ( currentProvider . version >= Version . v2 ) {
1927- console . warn ( " Configuration Provider timed out in {0 }ms." , configProviderTimeout ) ;
1929+ console . warn ( ` Configuration Provider timed out in ${ configProviderTimeout } ms.` ) ;
19281930 void this . resumeParsing ( ) . catch ( logAndReturn . undefined ) ;
19291931 }
19301932 }
@@ -3500,20 +3502,25 @@ export class DefaultClient implements Client {
35003502 return this . handleRemoveCodeAnalysisProblems ( false , identifiersAndUris ) ;
35013503 }
35023504
3503- public async handleCreateDeclarationOrDefinition ( copy ? : boolean ) : Promise < void > {
3505+ public async handleCreateDeclarationOrDefinition ( isCopyToClipboard : boolean , codeActionRange ?: Range ) : Promise < void > {
35043506 let range : vscode . Range | undefined ;
35053507 let uri : vscode . Uri | undefined ;
35063508
3507- // range is based on the cursor position.
35083509 const editor : vscode . TextEditor | undefined = vscode . window . activeTextEditor ;
35093510 if ( editor ) {
35103511 uri = editor . document . uri ;
3511- if ( editor . selection . isEmpty ) {
3512- range = new vscode . Range ( editor . selection . active , editor . selection . active ) ;
3513- } else if ( editor . selection . isReversed ) {
3514- range = new vscode . Range ( editor . selection . active , editor . selection . anchor ) ;
3512+ if ( codeActionRange !== undefined ) {
3513+ // Request is from a code action command which provides range from code actions args.
3514+ range = makeVscodeRange ( codeActionRange ) ;
35153515 } else {
3516- range = new vscode . Range ( editor . selection . anchor , editor . selection . active ) ;
3516+ // Request is from context menu or command palette. Use range from cursor position.
3517+ if ( editor . selection . isEmpty ) {
3518+ range = new vscode . Range ( editor . selection . active , editor . selection . active ) ;
3519+ } else if ( editor . selection . isReversed ) {
3520+ range = new vscode . Range ( editor . selection . active , editor . selection . anchor ) ;
3521+ } else {
3522+ range = new vscode . Range ( editor . selection . anchor , editor . selection . active ) ;
3523+ }
35173524 }
35183525 }
35193526
@@ -3533,7 +3540,7 @@ export class DefaultClient implements Client {
35333540 line : range . end . line
35343541 }
35353542 } ,
3536- copyToClipboard : copy ?? false
3543+ copyToClipboard : isCopyToClipboard
35373544 } ;
35383545
35393546 const result : CreateDeclarationOrDefinitionResult = await this . languageClient . sendRequest ( CreateDeclarationOrDefinitionRequest , params ) ;
@@ -3823,7 +3830,7 @@ class NullClient implements Client {
38233830 handleRemoveCodeAnalysisProblems ( refreshSquigglesOnSave : boolean , identifiersAndUris : CodeAnalysisDiagnosticIdentifiersAndUri [ ] ) : Promise < void > { return Promise . resolve ( ) ; }
38243831 handleFixCodeAnalysisProblems ( workspaceEdit : vscode . WorkspaceEdit , refreshSquigglesOnSave : boolean , identifiersAndUris : CodeAnalysisDiagnosticIdentifiersAndUri [ ] ) : Promise < void > { return Promise . resolve ( ) ; }
38253832 handleDisableAllTypeCodeAnalysisProblems ( code : string , identifiersAndUris : CodeAnalysisDiagnosticIdentifiersAndUri [ ] ) : Promise < void > { return Promise . resolve ( ) ; }
3826- handleCreateDeclarationOrDefinition ( copy ? : boolean ) : Promise < void > { return Promise . resolve ( ) ; }
3833+ handleCreateDeclarationOrDefinition ( isCopyToClipboard : boolean , codeActionRange ?: Range ) : Promise < void > { return Promise . resolve ( ) ; }
38273834 onInterval ( ) : void { }
38283835 dispose ( ) : void {
38293836 this . booleanEvent . dispose ( ) ;
0 commit comments