mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
merge with origin/release-2.0.5
This commit is contained in:
+12
-1
@@ -216,7 +216,18 @@ namespace ts.server {
|
||||
return {
|
||||
isMemberCompletion: false,
|
||||
isNewIdentifierLocation: false,
|
||||
entries: response.body
|
||||
entries: response.body.map(entry => {
|
||||
|
||||
if (entry.replacementSpan !== undefined) {
|
||||
const { name, kind, kindModifiers, sortText, replacementSpan} = entry;
|
||||
|
||||
const convertedSpan = createTextSpanFromBounds(this.lineOffsetToPosition(fileName, replacementSpan.start),
|
||||
this.lineOffsetToPosition(fileName, replacementSpan.end));
|
||||
return { name, kind, kindModifiers, sortText, replacementSpan: convertedSpan };
|
||||
}
|
||||
|
||||
return entry as { name: string, kind: string, kindModifiers: string, sortText: string };
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -341,6 +341,7 @@ namespace ts.server {
|
||||
|
||||
// capture list of projects since detachAllProjects will wipe out original list
|
||||
const containingProjects = info.containingProjects.slice();
|
||||
|
||||
info.detachAllProjects();
|
||||
|
||||
// update projects to make sure that set of referenced files is correct
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
getCurrentDirectory(): string {
|
||||
return "";
|
||||
return this.host.getCurrentDirectory();
|
||||
}
|
||||
|
||||
resolvePath(path: string): string {
|
||||
|
||||
Vendored
+5
@@ -965,6 +965,11 @@ declare namespace ts.server.protocol {
|
||||
* is often the same as the name but may be different in certain circumstances.
|
||||
*/
|
||||
sortText: string;
|
||||
/**
|
||||
* An optional span that indicates the text to be replaced by this completion item. If present,
|
||||
* this span should be used instead of the default one.
|
||||
*/
|
||||
replacementSpan?: TextSpan;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+11
-1
@@ -923,7 +923,17 @@ namespace ts.server {
|
||||
if (simplifiedResult) {
|
||||
return completions.entries.reduce((result: protocol.CompletionEntry[], entry: ts.CompletionEntry) => {
|
||||
if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) {
|
||||
result.push(entry);
|
||||
const { name, kind, kindModifiers, sortText, replacementSpan } = entry;
|
||||
|
||||
let convertedSpan: protocol.TextSpan = undefined;
|
||||
if (replacementSpan) {
|
||||
convertedSpan = {
|
||||
start: scriptInfo.positionToLineOffset(replacementSpan.start),
|
||||
end: scriptInfo.positionToLineOffset(replacementSpan.start + replacementSpan.length)
|
||||
};
|
||||
}
|
||||
|
||||
result.push({ name, kind, kindModifiers, sortText, replacementSpan: convertedSpan });
|
||||
}
|
||||
return result;
|
||||
}, []).sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
Reference in New Issue
Block a user