mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
#20878 add string checks
This commit is contained in:
parent
24e37966be
commit
7b76b74e4c
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue