提交 7b76b74e 编写于 作者: S Sandeep Somavarapu

#20878 add string checks

上级 24e37966
......@@ -160,7 +160,7 @@ export class SettingsDocument {
// Suggestion model word matching includes quotes,
// hence exclude the starting quote from the snippet and the range
// ending quote gets replaced
if (text.startsWith('"')) {
if (text && text.startsWith('"')) {
range = new vscode.Range(new vscode.Position(range.start.line, range.start.character + 1), range.end);
snippet = snippet.substring(1);
}
......@@ -173,7 +173,7 @@ export class SettingsDocument {
})]);
}
if (location.path.length === 1 && location.previousNode && location.previousNode.value.startsWith('[')) {
if (location.path.length === 1 && location.previousNode && typeof location.previousNode.value === 'string' && location.previousNode.value.startsWith('[')) {
// Suggestion model word matching includes starting quote and open sqaure bracket
// Hence exclude them from the proposal range
......
......@@ -33,7 +33,7 @@ export class PackageDocument {
// Suggestion model word matching includes quotes,
// hence exclude the starting quote from the snippet and the range
// ending quote gets replaced
if (text.startsWith('"')) {
if (text && text.startsWith('"')) {
range = new vscode.Range(new vscode.Position(range.start.line, range.start.character + 1), range.end);
snippet = snippet.substring(1);
}
......@@ -46,7 +46,7 @@ export class PackageDocument {
})]);
}
if (location.path.length === 3 && location.previousNode && location.previousNode.value.startsWith('[')) {
if (location.path.length === 3 && location.previousNode && typeof location.previousNode.value === 'string' && location.previousNode.value.startsWith('[')) {
// Suggestion model word matching includes starting quote and open sqaure bracket
// Hence exclude them from the proposal range
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册