Skip to content

Commit

Permalink
Update to finalized protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Apr 10, 2023
1 parent ee308dc commit 91b6311
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ class JsxLinkedEditingSupport implements vscode.LinkedEditingRangeProvider {
}

const args = typeConverters.Position.toFileLocationRequestArgs(filepath, position);
const response = await this.client.execute('LinkedEditing', args, token);
const response = await this.client.execute('linkedEditingRange', args, token);
if (response.type !== 'response' || !response.body) {
return undefined;
}

const wordPattern = undefined;//response.body.wordPattern ? new RegExp(response.body.wordPattern) : undefined;
const wordPattern = response.body.wordPattern ? new RegExp(response.body.wordPattern) : undefined;
return new vscode.LinkedEditingRanges(response.body.ranges.map(range => typeConverters.Range.fromTextSpan(range)), wordPattern);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,13 @@ declare module 'typescript/lib/tsserverlibrary' {
filepath: string;
};

interface LinkedEditingRequest extends FileLocationRequest {
readonly command: 'LinkedEditing';
}

interface LinkedEditingRanges {
interface LinkedEditingRangesBody {
ranges: TextSpan[];
wordPattern?: string;
}

interface LinkedEditingResponse extends Response {
readonly body: LinkedEditingRanges;
interface LinkedEditingRangeResponse extends Response {
readonly body: LinkedEditingRangesBody;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ interface StandardTsServerRequests {
'findSourceDefinition': [Proto.FileLocationRequestArgs, Proto.DefinitionResponse];
'getMoveToRefactoringFileSuggestions': [Proto.GetMoveToRefactoringFileSuggestionsRequestArgs, Proto.GetMoveToRefactoringFileSuggestionsResponse];
'getEditsForMoveToFileRefactor': [Proto.GetEditsForMoveToFileRefactorRequestArgs, Proto.GetEditsForMoveToFileRefactorResponse];
'LinkedEditing': [Proto.FileLocationRequestArgs, Proto.LinkedEditingResponse];
'linkedEditingRange': [Proto.FileLocationRequestArgs, Proto.LinkedEditingRangeResponse];
}

interface NoResponseTsServerRequests {
Expand Down

0 comments on commit 91b6311

Please sign in to comment.