@codingame/monaco-vscode-keybindings-service-override 25.1.2 → 26.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-keybindings-service-override",
3
- "version": "25.1.2",
3
+ "version": "26.0.1",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - keybindings service-override",
6
6
  "keywords": [],
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "25.1.2",
19
- "@codingame/monaco-vscode-files-service-override": "25.1.2"
18
+ "@codingame/monaco-vscode-api": "26.0.1",
19
+ "@codingame/monaco-vscode-files-service-override": "26.0.1"
20
20
  },
21
21
  "main": "index.js",
22
22
  "module": "index.js",
@@ -5,39 +5,42 @@ import { Extensions, ConfigurationScope } from '@codingame/monaco-vscode-api/vsc
5
5
  import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
6
6
 
7
7
  var DispatchConfig;
8
- (function (DispatchConfig) {
8
+ (function(DispatchConfig) {
9
9
  DispatchConfig[DispatchConfig["Code"] = 0] = "Code";
10
10
  DispatchConfig[DispatchConfig["KeyCode"] = 1] = "KeyCode";
11
11
  })(DispatchConfig || (DispatchConfig = {}));
12
12
  function readKeyboardConfig(configurationService) {
13
- const keyboard = configurationService.getValue('keyboard');
14
- const dispatch = (keyboard?.dispatch === 'keyCode' ? DispatchConfig.KeyCode : DispatchConfig.Code);
13
+ const keyboard = configurationService.getValue("keyboard");
14
+ const dispatch = (keyboard?.dispatch === "keyCode" ? DispatchConfig.KeyCode : DispatchConfig.Code);
15
15
  const mapAltGrToCtrlAlt = Boolean(keyboard?.mapAltGrToCtrlAlt);
16
- return { dispatch, mapAltGrToCtrlAlt };
16
+ return {
17
+ dispatch,
18
+ mapAltGrToCtrlAlt
19
+ };
17
20
  }
18
21
  const configurationRegistry = ( Registry.as(Extensions.Configuration));
19
22
  const keyboardConfiguration = {
20
- 'id': 'keyboard',
21
- 'order': 15,
22
- 'type': 'object',
23
- 'title': ( localize(1952, "Keyboard")),
24
- 'properties': {
25
- 'keyboard.dispatch': {
23
+ "id": "keyboard",
24
+ "order": 15,
25
+ "type": "object",
26
+ "title": ( localize(1954, "Keyboard")),
27
+ "properties": {
28
+ "keyboard.dispatch": {
26
29
  scope: ConfigurationScope.APPLICATION,
27
- type: 'string',
28
- enum: ['code', 'keyCode'],
29
- default: 'code',
30
+ type: "string",
31
+ enum: ["code", "keyCode"],
32
+ default: "code",
30
33
  markdownDescription: ( localize(
31
- 1953,
34
+ 1955,
32
35
  "Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."
33
36
  )),
34
37
  included: OS === OperatingSystem.Macintosh || OS === OperatingSystem.Linux
35
38
  },
36
- 'keyboard.mapAltGrToCtrlAlt': {
39
+ "keyboard.mapAltGrToCtrlAlt": {
37
40
  scope: ConfigurationScope.APPLICATION,
38
- type: 'boolean',
41
+ type: "boolean",
39
42
  default: false,
40
- markdownDescription: ( localize(1954, "Controls if the AltGraph+ modifier should be treated as Ctrl+Alt+.")),
43
+ markdownDescription: ( localize(1956, "Controls if the AltGraph+ modifier should be treated as Ctrl+Alt+.")),
41
44
  included: OS === OperatingSystem.Windows
42
45
  }
43
46
  }
@@ -9,53 +9,44 @@ import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/pla
9
9
  class RunCommands extends Action2 {
10
10
  constructor() {
11
11
  super({
12
- id: 'runCommands',
13
- title: ( localize2(6279, "Run Commands")),
12
+ id: "runCommands",
13
+ title: ( localize2(6592, "Run Commands")),
14
14
  f1: false,
15
15
  metadata: {
16
- description: ( localize(6280, "Run several commands")),
17
- args: [
18
- {
19
- name: 'args',
20
- schema: {
21
- type: 'object',
22
- required: ['commands'],
23
- properties: {
24
- commands: {
25
- type: 'array',
26
- description: ( localize(6281, "Commands to run")),
27
- items: {
28
- anyOf: [
29
- {
30
- $ref: 'vscode://schemas/keybindings#/definitions/commandNames'
31
- },
32
- {
33
- type: 'string',
34
- },
35
- {
36
- type: 'object',
37
- required: ['command'],
38
- properties: {
39
- command: {
40
- 'anyOf': [
41
- {
42
- $ref: 'vscode://schemas/keybindings#/definitions/commandNames'
43
- },
44
- {
45
- type: 'string'
46
- },
47
- ]
48
- }
49
- },
50
- $ref: 'vscode://schemas/keybindings#/definitions/commandsSchemas'
16
+ description: ( localize(6593, "Run several commands")),
17
+ args: [{
18
+ name: "args",
19
+ schema: {
20
+ type: "object",
21
+ required: ["commands"],
22
+ properties: {
23
+ commands: {
24
+ type: "array",
25
+ description: ( localize(6594, "Commands to run")),
26
+ items: {
27
+ anyOf: [{
28
+ $ref: "vscode://schemas/keybindings#/definitions/commandNames"
29
+ }, {
30
+ type: "string"
31
+ }, {
32
+ type: "object",
33
+ required: ["command"],
34
+ properties: {
35
+ command: {
36
+ "anyOf": [{
37
+ $ref: "vscode://schemas/keybindings#/definitions/commandNames"
38
+ }, {
39
+ type: "string"
40
+ }]
51
41
  }
52
- ]
53
- }
42
+ },
43
+ $ref: "vscode://schemas/keybindings#/definitions/commandsSchemas"
44
+ }]
54
45
  }
55
46
  }
56
47
  }
57
48
  }
58
- ]
49
+ }]
59
50
  }
60
51
  });
61
52
  }
@@ -63,14 +54,14 @@ class RunCommands extends Action2 {
63
54
  const notificationService = accessor.get(INotificationService);
64
55
  if (!this._isCommandArgs(args)) {
65
56
  notificationService.error(( localize(
66
- 6282,
57
+ 6595,
67
58
  "'runCommands' has received an argument with incorrect type. Please, review the argument passed to the command."
68
59
  )));
69
60
  return;
70
61
  }
71
62
  if (args.commands.length === 0) {
72
63
  notificationService.warn(( localize(
73
- 6283,
64
+ 6596,
74
65
  "'runCommands' has not received commands to run. Did you forget to pass commands in the 'runCommands' argument?"
75
66
  )));
76
67
  return;
@@ -85,24 +76,25 @@ class RunCommands extends Action2 {
85
76
  await this._runCommand(commandService, cmd);
86
77
  logService.debug(`runCommands: executed ${i}-th command`);
87
78
  }
88
- }
89
- catch (err) {
90
- logService.debug(`runCommands: executing ${i}-th command resulted in an error: ${err instanceof Error ? err.message : safeStringify(err)}`);
79
+ } catch (err) {
80
+ logService.debug(
81
+ `runCommands: executing ${i}-th command resulted in an error: ${err instanceof Error ? err.message : safeStringify(err)}`
82
+ );
91
83
  notificationService.error(err);
92
84
  }
93
85
  }
94
86
  _isCommandArgs(args) {
95
- if (!args || typeof args !== 'object') {
87
+ if (!args || typeof args !== "object") {
96
88
  return false;
97
89
  }
98
- if (!('commands' in args) || !Array.isArray(args.commands)) {
90
+ if (!("commands" in args) || !Array.isArray(args.commands)) {
99
91
  return false;
100
92
  }
101
93
  for (const cmd of args.commands) {
102
- if (typeof cmd === 'string') {
94
+ if (typeof cmd === "string") {
103
95
  continue;
104
96
  }
105
- if (typeof cmd === 'object' && typeof cmd.command === 'string') {
97
+ if (typeof cmd === "object" && typeof cmd.command === "string") {
106
98
  continue;
107
99
  }
108
100
  return false;
@@ -111,21 +103,18 @@ class RunCommands extends Action2 {
111
103
  }
112
104
  _runCommand(commandService, cmd) {
113
105
  let commandID, commandArgs;
114
- if (typeof cmd === 'string') {
106
+ if (typeof cmd === "string") {
115
107
  commandID = cmd;
116
- }
117
- else {
108
+ } else {
118
109
  commandID = cmd.command;
119
110
  commandArgs = cmd.args;
120
111
  }
121
112
  if (commandArgs === undefined) {
122
113
  return commandService.executeCommand(commandID);
123
- }
124
- else {
114
+ } else {
125
115
  if (Array.isArray(commandArgs)) {
126
116
  return commandService.executeCommand(commandID, ...commandArgs);
127
- }
128
- else {
117
+ } else {
129
118
  return commandService.executeCommand(commandID, commandArgs);
130
119
  }
131
120
  }
@@ -14,8 +14,8 @@ import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/even
14
14
  class ToggleKeybindingsLogAction extends Action2 {
15
15
  constructor() {
16
16
  super({
17
- id: 'workbench.action.toggleKeybindingsLog',
18
- title: ( localize2(8502, "Toggle Keyboard Shortcuts Troubleshooting")),
17
+ id: "workbench.action.toggleKeybindingsLog",
18
+ title: ( localize2(8809, "Toggle Keyboard Shortcuts Troubleshooting")),
19
19
  category: Categories.Developer,
20
20
  f1: true
21
21
  });
@@ -34,26 +34,34 @@ class ToggleKeybindingsLogAction extends Action2 {
34
34
  const layoutService = accessor.get(ILayoutService);
35
35
  const disposables = ( new DisposableStore());
36
36
  const container = layoutService.activeContainer;
37
- const focusMarker = append(container, $('.focus-troubleshooting-marker'));
37
+ const focusMarker = append(container, $(".focus-troubleshooting-marker"));
38
38
  disposables.add(toDisposable(() => focusMarker.remove()));
39
39
  const stylesheet = createStyleSheet(undefined, undefined, disposables);
40
- createCSSRule('.focus-troubleshooting-marker', `
41
- position: fixed;
42
- pointer-events: none;
43
- z-index: 100000;
44
- background-color: rgba(255, 0, 0, 0.2);
45
- border: 2px solid rgba(255, 0, 0, 0.8);
46
- border-radius: 2px;
47
- display: none;
48
- `, stylesheet);
40
+ createCSSRule(".focus-troubleshooting-marker", `
41
+ position: fixed;
42
+ pointer-events: none;
43
+ z-index: 100000;
44
+ background-color: rgba(255, 0, 0, 0.2);
45
+ border: 2px solid rgba(255, 0, 0, 0.8);
46
+ border-radius: 2px;
47
+ display: none;
48
+ `, stylesheet);
49
49
  const onKeyDown = disposables.add(( new Emitter()));
50
50
  function registerWindowListeners(window, disposables) {
51
- disposables.add(addDisposableListener(window, 'keydown', e => onKeyDown.fire(e), true));
51
+ disposables.add(addDisposableListener(window, "keydown", e => onKeyDown.fire(e), true));
52
52
  }
53
- for (const { window, disposables } of getWindows()) {
53
+ for (const {
54
+ window,
55
+ disposables
56
+ } of getWindows()) {
54
57
  registerWindowListeners(window, disposables);
55
58
  }
56
- disposables.add(onDidRegisterWindow(({ window, disposables }) => registerWindowListeners(window, disposables)));
59
+ disposables.add(onDidRegisterWindow((
60
+ {
61
+ window,
62
+ disposables
63
+ }
64
+ ) => registerWindowListeners(window, disposables)));
57
65
  disposables.add(layoutService.onDidChangeActiveContainer(() => {
58
66
  layoutService.activeContainer.appendChild(focusMarker);
59
67
  }));
@@ -65,9 +73,9 @@ class ToggleKeybindingsLogAction extends Action2 {
65
73
  focusMarker.style.left = `${position.left}px`;
66
74
  focusMarker.style.width = `${position.width}px`;
67
75
  focusMarker.style.height = `${position.height}px`;
68
- focusMarker.style.display = 'block';
76
+ focusMarker.style.display = "block";
69
77
  setTimeout(() => {
70
- focusMarker.style.display = 'none';
78
+ focusMarker.style.display = "none";
71
79
  }, 800);
72
80
  }
73
81
  }));
@@ -24,7 +24,7 @@ import { DEFINE_KEYBINDING_EDITOR_CONTRIB_ID } from '@codingame/monaco-vscode-ap
24
24
 
25
25
  var KeybindingEditorDecorationsRenderer_1;
26
26
  const NLS_KB_LAYOUT_ERROR_MESSAGE = ( localize(
27
- 9871,
27
+ 10189,
28
28
  "You won't be able to produce this key combination under your current keyboard layout."
29
29
  ));
30
30
  let DefineKeybindingEditorContribution = class DefineKeybindingEditorContribution extends Disposable {
@@ -34,14 +34,15 @@ let DefineKeybindingEditorContribution = class DefineKeybindingEditorContributio
34
34
  this._instantiationService = _instantiationService;
35
35
  this._userDataProfileService = _userDataProfileService;
36
36
  this._keybindingDecorationRenderer = this._register(( new MutableDisposable()));
37
- this._defineWidget = this._register(this._instantiationService.createInstance(DefineKeybindingOverlayWidget, this._editor));
37
+ this._defineWidget = this._register(
38
+ this._instantiationService.createInstance(DefineKeybindingOverlayWidget, this._editor)
39
+ );
38
40
  this._register(this._editor.onDidChangeModel(e => this._update()));
39
41
  this._update();
40
42
  }
41
43
  _update() {
42
- this._keybindingDecorationRenderer.value = isInterestingEditorModel(this._editor, this._userDataProfileService)
43
- ? this._instantiationService.createInstance(KeybindingEditorDecorationsRenderer, this._editor)
44
- : undefined;
44
+ this._keybindingDecorationRenderer.value =
45
+ isInterestingEditorModel(this._editor, this._userDataProfileService) ? this._instantiationService.createInstance(KeybindingEditorDecorationsRenderer, this._editor) : undefined;
45
46
  }
46
47
  showDefineKeybindingWidget() {
47
48
  if (isInterestingEditorModel(this._editor, this._userDataProfileService)) {
@@ -54,26 +55,26 @@ let DefineKeybindingEditorContribution = class DefineKeybindingEditorContributio
54
55
  const regexp = ( new RegExp(/\\/g));
55
56
  const backslash = regexp.test(keybinding);
56
57
  if (backslash) {
57
- keybinding = keybinding.slice(0, -1) + '\\\\';
58
+ keybinding = keybinding.slice(0, -1) + "\\\\";
58
59
  }
59
60
  let snippetText = [
60
- '{',
61
- '\t"key": ' + JSON.stringify(keybinding) + ',',
62
- '\t"command": "${1:commandId}",',
63
- '\t"when": "${2:editorTextFocus}"',
64
- '}$0'
65
- ].join('\n');
61
+ "{",
62
+ "\t\"key\": " + JSON.stringify(keybinding) + ",",
63
+ "\t\"command\": \"${1:commandId}\",",
64
+ "\t\"when\": \"${2:editorTextFocus}\"",
65
+ "}$0"
66
+ ].join("\n");
66
67
  const smartInsertInfo = SmartSnippetInserter.insertSnippet(this._editor.getModel(), this._editor.getPosition());
67
68
  snippetText = smartInsertInfo.prepend + snippetText + smartInsertInfo.append;
68
69
  this._editor.setPosition(smartInsertInfo.position);
69
- SnippetController2.get(this._editor)?.insert(snippetText, { overwriteBefore: 0, overwriteAfter: 0 });
70
+ SnippetController2.get(this._editor)?.insert(snippetText, {
71
+ overwriteBefore: 0,
72
+ overwriteAfter: 0
73
+ });
70
74
  }
71
75
  }
72
76
  };
73
- DefineKeybindingEditorContribution = ( __decorate([
74
- ( __param(1, IInstantiationService)),
75
- ( __param(2, IUserDataProfileService))
76
- ], DefineKeybindingEditorContribution));
77
+ DefineKeybindingEditorContribution = ( __decorate([( __param(1, IInstantiationService)), ( __param(2, IUserDataProfileService))], DefineKeybindingEditorContribution));
77
78
  let KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1 = class KeybindingEditorDecorationsRenderer extends Disposable {
78
79
  constructor(_editor, _keybindingService) {
79
80
  super();
@@ -83,7 +84,9 @@ let KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1
83
84
  this._updateDecorations = this._register(( new RunOnceScheduler(() => this._updateDecorationsNow(), 500)));
84
85
  const model = assertReturnsDefined(this._editor.getModel());
85
86
  this._register(model.onDidChangeContent(() => this._updateDecorations.schedule()));
86
- this._register(this._keybindingService.onDidUpdateKeybindings(() => this._updateDecorations.schedule()));
87
+ this._register(
88
+ this._keybindingService.onDidUpdateKeybindings(() => this._updateDecorations.schedule())
89
+ );
87
90
  this._register({
88
91
  dispose: () => {
89
92
  this._dec.clear();
@@ -113,18 +116,18 @@ let KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1
113
116
  }
114
117
  for (let i = 0, len = entry.children.length; i < len; i++) {
115
118
  const prop = entry.children[i];
116
- if (prop.type !== 'property') {
119
+ if (prop.type !== "property") {
117
120
  continue;
118
121
  }
119
122
  if (!Array.isArray(prop.children) || prop.children.length !== 2) {
120
123
  continue;
121
124
  }
122
125
  const key = prop.children[0];
123
- if (key.value !== 'key') {
126
+ if (key.value !== "key") {
124
127
  continue;
125
128
  }
126
129
  const value = prop.children[1];
127
- if (value.type !== 'string') {
130
+ if (value.type !== "string") {
128
131
  continue;
129
132
  }
130
133
  const resolvedKeybindings = this._keybindingService.resolveUserBinding(value.value);
@@ -138,7 +141,7 @@ let KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1
138
141
  }
139
142
  if (!resolvedKeybinding.isWYSIWYG()) {
140
143
  const uiLabel = resolvedKeybinding.getLabel();
141
- if (typeof uiLabel === 'string' && value.value.toLowerCase() === uiLabel.toLowerCase()) {
144
+ if (typeof uiLabel === "string" && value.value.toLowerCase() === uiLabel.toLowerCase()) {
142
145
  return null;
143
146
  }
144
147
  return this._createDecoration(false, resolvedKeybinding.getLabel(), usLabel, model, value);
@@ -147,7 +150,7 @@ let KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1
147
150
  return this._createDecoration(false, resolvedKeybinding.getLabel(), usLabel, model, value);
148
151
  }
149
152
  const expectedUserSettingsLabel = resolvedKeybinding.getUserSettingsLabel();
150
- if (typeof expectedUserSettingsLabel === 'string' && !KeybindingEditorDecorationsRenderer_1._userSettingsFuzzyEquals(value.value, expectedUserSettingsLabel)) {
153
+ if (typeof expectedUserSettingsLabel === "string" && !KeybindingEditorDecorationsRenderer_1._userSettingsFuzzyEquals(value.value, expectedUserSettingsLabel)) {
151
154
  return this._createDecoration(false, resolvedKeybinding.getLabel(), usLabel, model, value);
152
155
  }
153
156
  return null;
@@ -176,22 +179,20 @@ let KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1
176
179
  let overviewRulerColor;
177
180
  if (isError) {
178
181
  msg = ( new MarkdownString()).appendText(NLS_KB_LAYOUT_ERROR_MESSAGE);
179
- className = 'keybindingError';
182
+ className = "keybindingError";
180
183
  overviewRulerColor = themeColorFromId(overviewRulerError);
181
- }
182
- else {
184
+ } else {
183
185
  if (usLabel && uiLabel !== usLabel) {
184
186
  msg = ( new MarkdownString(( localize(
185
- 9872,
187
+ 10190,
186
188
  "**{0}** for your current keyboard layout (**{1}** for US standard).",
187
189
  uiLabel,
188
190
  usLabel
189
191
  ))));
192
+ } else {
193
+ msg = ( new MarkdownString(( localize(10191, "**{0}** for your current keyboard layout.", uiLabel))));
190
194
  }
191
- else {
192
- msg = ( new MarkdownString(( localize(9873, "**{0}** for your current keyboard layout.", uiLabel))));
193
- }
194
- className = 'keybindingInfo';
195
+ className = "keybindingInfo";
195
196
  overviewRulerColor = themeColorFromId(overviewRulerInfo);
196
197
  }
197
198
  const startPosition = model.getPositionAt(keyNode.offset);
@@ -205,7 +206,7 @@ let KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1
205
206
  return {
206
207
  range: range,
207
208
  options: {
208
- description: 'keybindings-widget',
209
+ description: "keybindings-widget",
209
210
  stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
210
211
  className: className,
211
212
  hoverMessage: msg,
@@ -217,9 +218,7 @@ let KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1
217
218
  };
218
219
  }
219
220
  };
220
- KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1 = ( __decorate([
221
- ( __param(1, IKeybindingService))
222
- ], KeybindingEditorDecorationsRenderer));
221
+ KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1 = ( __decorate([( __param(1, IKeybindingService))], KeybindingEditorDecorationsRenderer));
223
222
  function isInterestingEditorModel(editor, userDataProfileService) {
224
223
  const model = editor.getModel();
225
224
  if (!model) {
@@ -227,6 +226,10 @@ function isInterestingEditorModel(editor, userDataProfileService) {
227
226
  }
228
227
  return isEqual(model.uri, userDataProfileService.currentProfile.keybindingsResource);
229
228
  }
230
- registerEditorContribution(DEFINE_KEYBINDING_EDITOR_CONTRIB_ID, DefineKeybindingEditorContribution, EditorContributionInstantiation.AfterFirstRender);
229
+ registerEditorContribution(
230
+ DEFINE_KEYBINDING_EDITOR_CONTRIB_ID,
231
+ DefineKeybindingEditorContribution,
232
+ EditorContributionInstantiation.AfterFirstRender
233
+ );
231
234
 
232
235
  export { KeybindingEditorDecorationsRenderer };
@@ -30,7 +30,7 @@ class SmartSnippetInserter {
30
30
  static insertSnippet(model, _position) {
31
31
  const desiredPosition = model.getValueLengthInRange(( new Range(1, 1, _position.lineNumber, _position.column)));
32
32
  let State;
33
- (function (State) {
33
+ (function(State) {
34
34
  State[State["INVALID"] = 0] = "INVALID";
35
35
  State[State["AFTER_OBJECT"] = 1] = "AFTER_OBJECT";
36
36
  State[State["BEFORE_OBJECT"] = 2] = "BEFORE_OBJECT";
@@ -46,8 +46,7 @@ class SmartSnippetInserter {
46
46
  currentState = state;
47
47
  lastValidPos = pos;
48
48
  lastValidState = state;
49
- }
50
- else {
49
+ } else {
51
50
  if (currentState !== State.INVALID) {
52
51
  currentState = State.INVALID;
53
52
  lastValidPos = scanner.getTokenOffset();
@@ -59,33 +58,33 @@ class SmartSnippetInserter {
59
58
  const kind = scanner.getToken();
60
59
  let goodKind = false;
61
60
  switch (kind) {
62
- case SyntaxKind.OpenBracketToken:
63
- goodKind = true;
64
- arrayLevel++;
65
- checkRangeStatus(currentPos, State.BEFORE_OBJECT);
66
- break;
67
- case SyntaxKind.CloseBracketToken:
68
- goodKind = true;
69
- arrayLevel--;
70
- checkRangeStatus(currentPos, State.INVALID);
71
- break;
72
- case SyntaxKind.CommaToken:
73
- goodKind = true;
74
- checkRangeStatus(currentPos, State.BEFORE_OBJECT);
75
- break;
76
- case SyntaxKind.OpenBraceToken:
77
- goodKind = true;
78
- objLevel++;
79
- checkRangeStatus(currentPos, State.INVALID);
80
- break;
81
- case SyntaxKind.CloseBraceToken:
82
- goodKind = true;
83
- objLevel--;
84
- checkRangeStatus(currentPos, State.AFTER_OBJECT);
85
- break;
86
- case SyntaxKind.Trivia:
87
- case SyntaxKind.LineBreakTrivia:
88
- goodKind = true;
61
+ case SyntaxKind.OpenBracketToken:
62
+ goodKind = true;
63
+ arrayLevel++;
64
+ checkRangeStatus(currentPos, State.BEFORE_OBJECT);
65
+ break;
66
+ case SyntaxKind.CloseBracketToken:
67
+ goodKind = true;
68
+ arrayLevel--;
69
+ checkRangeStatus(currentPos, State.INVALID);
70
+ break;
71
+ case SyntaxKind.CommaToken:
72
+ goodKind = true;
73
+ checkRangeStatus(currentPos, State.BEFORE_OBJECT);
74
+ break;
75
+ case SyntaxKind.OpenBraceToken:
76
+ goodKind = true;
77
+ objLevel++;
78
+ checkRangeStatus(currentPos, State.INVALID);
79
+ break;
80
+ case SyntaxKind.CloseBraceToken:
81
+ goodKind = true;
82
+ objLevel--;
83
+ checkRangeStatus(currentPos, State.AFTER_OBJECT);
84
+ break;
85
+ case SyntaxKind.Trivia:
86
+ case SyntaxKind.LineBreakTrivia:
87
+ goodKind = true;
89
88
  }
90
89
  if (currentPos >= desiredPosition && (currentState !== State.INVALID || lastValidPos !== -1)) {
91
90
  let acceptPosition;
@@ -93,24 +92,22 @@ class SmartSnippetInserter {
93
92
  if (currentState !== State.INVALID) {
94
93
  acceptPosition = (goodKind ? currentPos : scanner.getTokenOffset());
95
94
  acceptState = currentState;
96
- }
97
- else {
95
+ } else {
98
96
  acceptPosition = lastValidPos;
99
97
  acceptState = lastValidState;
100
98
  }
101
99
  if (acceptState === State.AFTER_OBJECT) {
102
100
  return {
103
101
  position: this.offsetToPosition(model, acceptPosition),
104
- prepend: ',',
105
- append: ''
102
+ prepend: ",",
103
+ append: ""
106
104
  };
107
- }
108
- else {
105
+ } else {
109
106
  scanner.setPosition(acceptPosition);
110
107
  return {
111
108
  position: this.offsetToPosition(model, acceptPosition),
112
- prepend: '',
113
- append: this.hasOpenBrace(scanner) ? ',' : ''
109
+ prepend: "",
110
+ append: this.hasOpenBrace(scanner) ? "," : ""
114
111
  };
115
112
  }
116
113
  }
@@ -118,8 +115,8 @@ class SmartSnippetInserter {
118
115
  const modelLineCount = model.getLineCount();
119
116
  return {
120
117
  position: ( new Position(modelLineCount, model.getLineMaxColumn(modelLineCount))),
121
- prepend: '\n[',
122
- append: ']'
118
+ prepend: "\n[",
119
+ append: "]"
123
120
  };
124
121
  }
125
122
  }