Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert from 1- to 0-based indexing for TypeScript completion spans #15679

Merged
merged 1 commit into from
Nov 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions extensions/typescript/src/features/completionItemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ class MyCompletionItem extends CompletionItem {
this.sortText = entry.sortText;
this.kind = MyCompletionItem.convertKind(entry.kind);
if (entry.replacementSpan) {
let span = entry.replacementSpan;
this.textEdit = TextEdit.replace(new Range(span.start.line, span.start.offset, span.end.line, span.end.offset), entry.name);
let span: protocol.TextSpan = entry.replacementSpan;
// The indexing for the range returned by the server uses 1-based indexing.
// We convert to 0-based indexing.
this.textEdit = TextEdit.replace(new Range(span.start.line - 1, span.start.offset - 1, span.end.line - 1, span.end.offset - 1), entry.name);
}
}

Expand Down