ember-tooling / ember-language-server

Language Server Protocol implementation for Ember.js projects
MIT License
97 stars 39 forks source link

`executeInitializers` blocks format on save in VSCode during first save of a file when VSCode is opened. #406

Open NullVoxPopuli opened 20 hours ago

NullVoxPopuli commented 20 hours ago

Note that this doesn't happen in neovim, but at the same time, I don't think I've told neovim to do anything with ELS on save.

This function: https://github.com/ember-tooling/ember-language-server/blob/4af2c1e703e901d4593b2b275654c9d0eed35866/src/server.ts#L170

Here is the ELS output channel information during first save ``` Info - 1:10:45 PM] lazy init enabled, waiting for config from VSCode "Initializing Ember Language Server at " [Info - 1:10:45 PM] UELS: executeInitializers [Info - 1:13:38 PM] Ember CLI project added at /apps/client [Info - 1:16:31 PM] /apps/client: registry initialized in 173472ms [Info - 1:16:31 PM] /apps/client: script registry initialized in 20ms [Info - 1:16:33 PM] soxhub-client registry version mismatch [-1, 0], regenerating... [Info - 1:16:33 PM] soxhub-client registry generated in 37ms, new version: 0 [Info - 1:16:45 PM] Ember CLI project added at /apps/documentation [Info - 1:16:57 PM] /apps/documentation: registry initialized in 12717ms [Info - 1:16:57 PM] /apps/documentation: script registry initialized in 1ms [Info - 1:16:57 PM] documentation-kolay registry version mismatch [-1, 0], regenerating... [Info - 1:16:57 PM] documentation-kolay registry generated in 2ms, new version: 0 [Info - 1:17:02 PM] Ember CLI project added at /libraries/client-core/test-app [Info - 1:17:07 PM] /libraries/client-core/test-app: registry initialized in 4858ms [Info - 1:17:07 PM] /libraries/client-core/test-app: script registry initialized in 2ms [Info - 1:17:07 PM] @auditboard/client-core-tests registry version mismatch [-1, 0], regenerating... [Info - 1:17:07 PM] @auditboard/client-core-tests registry generated in 1ms, new version: 0 [Info - 1:17:08 PM] Ember CLI project added at /libraries/consts/test-app [Info - 1:17:08 PM] /libraries/consts/test-app: registry initialized in 209ms [Info - 1:17:08 PM] /libraries/consts/test-app: script registry initialized in 1ms [Info - 1:17:08 PM] @auditboard/consts-tests registry version mismatch [-1, 0], regenerating... [Info - 1:17:08 PM] @auditboard/consts-tests registry generated in 0ms, new version: 0 [Info - 1:17:08 PM] Ember CLI project added at /libraries/data/test-app [Info - 1:17:09 PM] /libraries/data/test-app: registry initialized in 955ms [Info - 1:17:09 PM] /libraries/data/test-app: script registry initialized in 0ms [Info - 1:17:09 PM] @auditboard/data-tests registry version mismatch [-1, 0], regenerating... [Info - 1:17:09 PM] @auditboard/data-tests registry generated in 0ms, new version: 0 [Info - 1:17:09 PM] Ember CLI project added at /libraries/ember-formatjs [Info - 1:17:09 PM] /libraries/ember-formatjs: registry initialized in 48ms [Info - 1:17:09 PM] /libraries/ember-formatjs: script registry initialized in 0ms [Info - 1:17:09 PM] @auditboard/ember-formatjs registry version mismatch [-1, 0], regenerating... [Info - 1:17:09 PM] @auditboard/ember-formatjs registry generated in 0ms, new version: 0 [Info - 1:17:10 PM] Ember CLI project added at /libraries/legacy-design-system [Info - 1:17:10 PM] /libraries/legacy-design-system: registry initialized in 455ms [Info - 1:17:10 PM] /libraries/legacy-design-system: script registry initialized in 1ms [Info - 1:17:10 PM] luna-design-system registry version mismatch [-1, 0], regenerating... [Info - 1:17:10 PM] luna-design-system registry generated in 0ms, new version: 0 [Info - 1:17:11 PM] Ember CLI project added at /libraries/luna-core/package [Info - 1:17:12 PM] /libraries/luna-core/package: registry initialized in 1029ms [Info - 1:17:12 PM] /libraries/luna-core/package: script registry initialized in 0ms [Info - 1:17:12 PM] luna registry version mismatch [-1, 0], regenerating... [Info - 1:17:12 PM] luna registry generated in 0ms, new version: 0 [Info - 1:17:14 PM] Ember CLI project added at /libraries/luna-core/test-app [Info - 1:17:15 PM] /libraries/luna-core/test-app: registry initialized in 1070ms [Info - 1:17:15 PM] /libraries/luna-core/test-app: script registry initialized in 0ms [Info - 1:17:15 PM] luna-tests registry version mismatch [-1, 0], regenerating... [Info - 1:17:15 PM] luna-tests registry generated in 0ms, new version: 0 [Info - 1:17:19 PM] Ember CLI project added at /libraries/luna-layouts/test-app [Info - 1:17:23 PM] /libraries/luna-layouts/test-app: registry initialized in 3939ms [Info - 1:17:23 PM] /libraries/luna-layouts/test-app: script registry initialized in 1ms [Info - 1:17:23 PM] @auditboard/luna-layouts-tests registry version mismatch [-1, 0], regenerating... [Info - 1:17:23 PM] @auditboard/luna-layouts-tests registry generated in 1ms, new version: 0 [Info - 1:17:23 PM] Ember CLI project added at /libraries/luna-utils/test-app [Info - 1:17:24 PM] /libraries/luna-utils/test-app: registry initialized in 388ms [Info - 1:17:24 PM] /libraries/luna-utils/test-app: script registry initialized in 0ms [Info - 1:17:24 PM] @auditboard/luna-utils-tests registry version mismatch [-1, 0], regenerating... [Info - 1:17:24 PM] @auditboard/luna-utils-tests registry generated in 0ms, new version: 0 [Info - 1:17:27 PM] Ember CLI project added at /libraries/luna-views/test-app [Info - 1:17:32 PM] /libraries/luna-views/test-app: registry initialized in 5153ms [Info - 1:17:32 PM] /libraries/luna-views/test-app: script registry initialized in 1ms [Info - 1:17:32 PM] luna-views-tests registry version mismatch [-1, 0], regenerating... [Info - 1:17:32 PM] luna-views-tests registry generated in 1ms, new version: 0 [Info - 1:17:35 PM] Ember CLI project added at /libraries/notifications/test-app [Info - 1:17:38 PM] /libraries/notifications/test-app: registry initialized in 2682ms [Info - 1:17:38 PM] /libraries/notifications/test-app: script registry initialized in 3ms [Info - 1:17:38 PM] @auditboard/notifications-tests registry version mismatch [-1, 0], regenerating... [Info - 1:17:38 PM] @auditboard/notifications-tests registry generated in 0ms, new version: 0 [Info - 1:17:44 PM] Ember CLI project added at /libraries/resource-planner/test-app [Info - 1:17:50 PM] /libraries/resource-planner/test-app: registry initialized in 5914ms [Info - 1:17:50 PM] /libraries/resource-planner/test-app: script registry initialized in 2ms [Info - 1:17:50 PM] resource-planner-tests registry version mismatch [-1, 0], regenerating... [Info - 1:17:50 PM] resource-planner-tests registry generated in 1ms, new version: 0 [Info - 1:17:50 PM] Ember CLI project added at /libraries/scheduler-pro/test-app [Info - 1:17:50 PM] /libraries/scheduler-pro/test-app: registry initialized in 151ms [Info - 1:17:50 PM] /libraries/scheduler-pro/test-app: script registry initialized in 1ms [Info - 1:17:50 PM] scheduler-pro-tests registry version mismatch [-1, 0], regenerating... [Info - 1:17:50 PM] scheduler-pro-tests registry generated in 0ms, new version: 0 [Info - 1:17:51 PM] Ember CLI project added at /libraries/schema-decorators/test-app [Info - 1:17:51 PM] /libraries/schema-decorators/test-app: registry initialized in 557ms [Info - 1:17:51 PM] /libraries/schema-decorators/test-app: script registry initialized in 2ms [Info - 1:17:51 PM] schema-decorators-tests registry version mismatch [-1, 0], regenerating... [Info - 1:17:51 PM] schema-decorators-tests registry generated in 1ms, new version: 0 [Info - 1:18:56 PM] Ember CLI project added at /libraries/schema-form/test-app [Info - 1:20:01 PM] /libraries/schema-form/test-app: registry initialized in 65323ms [Info - 1:20:01 PM] /libraries/schema-form/test-app: script registry initialized in 2ms [Info - 1:20:01 PM] @auditboard/schema-form-tests registry version mismatch [-1, 0], regenerating... [Info - 1:20:01 PM] @auditboard/schema-form-tests registry generated in 5ms, new version: 0 [Info - 1:20:16 PM] Ember CLI project added at /libraries/schema-table/test-app [Info - 1:20:31 PM] /libraries/schema-table/test-app: registry initialized in 15010ms [Info - 1:20:31 PM] /libraries/schema-table/test-app: script registry initialized in 0ms [Info - 1:20:31 PM] @auditboard/schema-table-tests registry version mismatch [-1, 0], regenerating... [Info - 1:20:31 PM] @auditboard/schema-table-tests registry generated in 2ms, new version: 0 [Info - 1:20:38 PM] Ember CLI project added at /libraries/sol-components/test-app [Info - 1:20:45 PM] /libraries/sol-components/test-app: registry initialized in 7366ms [Info - 1:20:45 PM] /libraries/sol-components/test-app: script registry initialized in 1ms [Info - 1:20:45 PM] @auditboard/sol-components-tests registry version mismatch [-1, 0], regenerating... [Info - 1:20:45 PM] @auditboard/sol-components-tests registry generated in 2ms, new version: 0 [Info - 1:20:52 PM] Ember CLI project added at /libraries/ui-schema/test-app [Info - 1:20:58 PM] /libraries/ui-schema/test-app: registry initialized in 6814ms [Info - 1:20:58 PM] /libraries/ui-schema/test-app: script registry initialized in 1ms [Info - 1:20:58 PM] ui-schema-tests registry version mismatch [-1, 0], regenerating... [Info - 1:20:58 PM] ui-schema-tests registry generated in 1ms, new version: 0 [Info - 1:20:59 PM] Ember CLI project added at /libraries/utils/test-app [Info - 1:20:59 PM] /libraries/utils/test-app: registry initialized in 561ms [Info - 1:20:59 PM] /libraries/utils/test-app: script registry initialized in 2ms [Info - 1:20:59 PM] @auditboard/utils-tests registry version mismatch [-1, 0], regenerating... [Info - 1:20:59 PM] @auditboard/utils-tests registry generated in 0ms, new version: 0 [Info - 1:20:59 PM] Unable to get project name from package.json at /tools/monorepo/src/tasks/new/files [Info - 1:20:59 PM] Ember CLI project added at /tools/monorepo/src/tasks/new/files [Info - 1:20:59 PM] /tools/monorepo/src/tasks/new/files: registry initialized in 0ms [Info - 1:20:59 PM] /tools/monorepo/src/tasks/new/files: script registry initialized in 0ms [Info - 1:20:59 PM] [Unknown Project] registry version mismatch [-1, 0], regenerating... [Info - 1:20:59 PM] [Unknown Project] registry generated in 0ms, new version: 0 ```

My VSCode config:

{
  "editor.minimap.enabled": false,
  "debug.javascript.autoAttachFilter": "always",
  "debug.javascript.pickAndAttachOptions": {},
  "debug.terminal.clearBeforeReusing": true,
  "terminal.integrated.inheritEnv": true,
  "terminal.integrated.profiles.osx": {
    "bash": {
      "path": "/opt/homebrew/bin/bash",
      "icon": "terminal-bash"
    }
  },
  "terminal.integrated.defaultProfile.linux": "",
  "terminal.integrated.defaultProfile.osx": "bash",
  "debug.javascript.terminalOptions": {
    "autoAttachChildProcesses": true
  },
  "[glimmer-js]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.foldingStrategy": "indentation"
  },
  "[glimmer-ts]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.foldingStrategy": "indentation"
  },
  "eslint.validate": [
    "javascript",
    "typescript",
    "html",
    "glimmer-js",
    "glimmer-ts"
  ],
  "prettier.documentSelectors": [
    "**/*.gjs",
    "**/*.gts"
  ],
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "keyboard.touchbar.enabled": false,
  "typescript.tsserver.maxTsServerMemory": 9000,
  "terminal.integrated.scrollback": 10000,
  "git.commandsToLog": ["post-checkout", "pre-commit"]
}
rtablada commented 20 hours ago

I have noticed that when saving, there are occasions where VSCode will say "waiting on Ember Language Server" in onSave but before formatting hook? Which seems odd since I'm not aware of ESL doing anything that would be save blocking (or maybe we could set this to be non-blocking and after save)?

Maybe there's some better VSCode level settings that can be pointed to if those hooks are already optout without changes to ESL?