Fix possible undefined access exception when using apply "first" for a code action and no code actions are returned
Fixes #63101
This commit is contained in:
parent
3c6b6e614d
commit
80aeb774f6
2 changed files with 65 additions and 1 deletions
64
extensions/typescript-language-features/tslint.json
Normal file
64
extensions/typescript-language-features/tslint.json
Normal file
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
"defaultSeverity": "warning",
|
||||
"extends": [
|
||||
"tslint:recommended"
|
||||
],
|
||||
"rules": {
|
||||
"member-ordering": false,
|
||||
"whitespace": false,
|
||||
"indent": [
|
||||
true,
|
||||
"tabs"
|
||||
],
|
||||
"interface-name": [
|
||||
true,
|
||||
"never-prefix"
|
||||
],
|
||||
"variable-name": [
|
||||
true,
|
||||
"check-format",
|
||||
"allow-leading-underscore"
|
||||
],
|
||||
"curly": [
|
||||
true,
|
||||
"ignore-same-line"
|
||||
],
|
||||
"member-access": [
|
||||
true
|
||||
],
|
||||
"max-classes-per-file": false,
|
||||
"no-empty": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"no-unused-expression": true,
|
||||
"arrow-parens": [
|
||||
true,
|
||||
"ban-single-arg-parens"
|
||||
],
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"eofline": false,
|
||||
"semicolon": [
|
||||
true,
|
||||
"always"
|
||||
],
|
||||
"class-name": true,
|
||||
"prefer-const": true,
|
||||
"import-spacing": true,
|
||||
"ordered-imports": false,
|
||||
"trailing-comma": [
|
||||
true,
|
||||
{
|
||||
"multiline": {
|
||||
"objects": "always",
|
||||
"arrays": "always",
|
||||
"functions": "ignore",
|
||||
"typeLiterals": "ignore"
|
||||
}
|
||||
}
|
||||
],
|
||||
"max-line-length": false,
|
||||
"no-bitwise": false
|
||||
}
|
||||
}
|
|
@ -93,7 +93,7 @@ export class QuickFixController implements IEditorContribution {
|
|||
// Triggered for specific scope
|
||||
// Apply if we only have one action or requested autoApply, otherwise show menu
|
||||
e.actions.then(fixes => {
|
||||
if (e.trigger.autoApply === CodeActionAutoApply.First || (e.trigger.autoApply === CodeActionAutoApply.IfSingle && fixes.length === 1)) {
|
||||
if (fixes.length > 0 && e.trigger.autoApply === CodeActionAutoApply.First || (e.trigger.autoApply === CodeActionAutoApply.IfSingle && fixes.length === 1)) {
|
||||
this._onApplyCodeAction(fixes[0]);
|
||||
} else {
|
||||
this._codeActionContextMenu.show(e.actions, e.position);
|
||||
|
|
Loading…
Reference in a new issue