Merge VS Code 1.23.1 (#1520)

This commit is contained in:
Matt Irvine
2018-06-05 11:24:51 -07:00
committed by GitHub
parent e3baf5c443
commit 0c58f09e59
3651 changed files with 74249 additions and 48599 deletions

View File

@@ -58,7 +58,7 @@ export class LRUMemory extends Memory {
this._cache.set(key, {
touch: this._seq++,
type: item.suggestion.type,
insertText: undefined
insertText: item.suggestion.insertText
});
}
@@ -66,18 +66,24 @@ export class LRUMemory extends Memory {
// in order of completions, select the first
// that has been used in the past
let { word } = model.getWordUntilPosition(pos);
if (word.length !== 0) {
return 0;
}
let lineSuffix = model.getLineContent(pos.lineNumber).substr(pos.column - 10, pos.column - 1);
if (/\s$/.test(lineSuffix)) {
return 0;
}
let res = 0;
let seq = -1;
if (word.length === 0) {
for (let i = 0; i < items.length; i++) {
const { suggestion } = items[i];
const key = `${model.getLanguageIdentifier().language}/${suggestion.label}`;
const item = this._cache.get(key);
if (item && item.touch > seq && item.type === suggestion.type) {
seq = item.touch;
res = i;
}
for (let i = 0; i < items.length; i++) {
const { suggestion } = items[i];
const key = `${model.getLanguageIdentifier().language}/${suggestion.label}`;
const item = this._cache.get(key);
if (item && item.touch > seq && item.type === suggestion.type && item.insertText === suggestion.insertText) {
seq = item.touch;
res = i;
}
}
return res;
@@ -192,7 +198,9 @@ export class SuggestMemories {
try {
const raw = this._storageService.get(`${this._storagePrefix}/${this._mode}`, StorageScope.WORKSPACE);
this._strategy.fromJSON(JSON.parse(raw));
if (raw) {
this._strategy.fromJSON(JSON.parse(raw));
}
} catch (e) {
// things can go wrong with JSON...
}