Skip to content

Fix client not starting (#608) #657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Fix client not starting (#608) #657

wants to merge 2 commits into from

Conversation

fbalda
Copy link

@fbalda fbalda commented Nov 9, 2022

Fixes #608 where the extension client (sometimes?) doesn't start after restarting VSCode.
Workspace.createFileSystemWatcher doesn't seem to create events for already existing files when starting VSCode so an initial scan for config files is necessary.

@bradlc
Copy link
Contributor

bradlc commented Nov 9, 2022

Hey @fbalda. We already do this when opening a document (and on activation for already opened files):

context.subscriptions.push(Workspace.onDidOpenTextDocument(didOpenTextDocument))
Workspace.textDocuments.forEach(didOpenTextDocument)

let [configFile] = await Workspace.findFiles(
new RelativePattern(folder, `**/${CONFIG_GLOB}`),
`{${getExcludePatterns(folder).join(',')}}`,
1
)

Were you able to identify exactly why the existing bootClientForFolderIfNeeded function doesn't boot the server for your project?

@fbalda
Copy link
Author

fbalda commented Nov 9, 2022

Hey @bradlc, yeah I totally missed that, sorry for the premature PR, shouldn't have rushed it.
I am investigating right now and it seems that

let [configFile] = await Workspace.findFiles(
new RelativePattern(folder, `**/${CONFIG_GLOB}`),
`{${getExcludePatterns(folder).join(',')}}`,
1
)

fails for me, I get:
error parsing glob '!/{/.git,/.svn,/.hg,/CVS,/.DS_Store,/Thumbs.db,"/*.js": { "when": "$(basename).ts" },/.classpath,/.project,/.settings,/.factorypath,/.git/,/node_modules/,/.hg/,/.svn/**}': nested alternate groups are not allowed

The { "when": "$(basename).ts" } in my settings.json seems to break it, removing the curly brackets in the template string for the exclude pattern {${getExcludePatterns(folder).join(',')}} fixes the issue for me

EDIT: Did some quick tests to confirm that the curly brackets are indeed not needed, the exclude pattern will work without them

@bradlc
Copy link
Contributor

bradlc commented Dec 13, 2022

Can you share your full VS Code settings in JSON format please @fbalda?

@fbalda
Copy link
Author

fbalda commented Dec 13, 2022

@bradlc Sure, here you go:

{
"settingsSync.ignoredSettings": [
"cmake.cmakePath",
"clang-format.executable"
],
"settingsSync.ignoredExtensions": ["apple-swift-format.path"],
"cmake.cmakePath": "/opt/homebrew/bin/cmake",
"clang-format.executable": "/opt/homebrew/opt/llvm/bin/clang-format",
"apple-swift-format.path": "/opt/homebrew/Cellar/swift-format/0.50500.0/bin/swift-format",
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.organizeImports": false
}
},
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": false
},
"git.autofetch": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"explorer.confirmDelete": false,
"files.exclude": {
""/*.js": { "when": "$(basename).ts" }": true,
"
/.classpath": true,
"/.project": true,
"
/.settings": true,
"**/.factorypath": true
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"cmake.configureOnOpen": true,
"[cpp]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"[c]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"explorer.confirmDragAndDrop": false,
"window.titleBarStyle": "custom",
"git.confirmSync": false,
"tslint.enable": false,
"eslint.format.enable": false,
"eslint.enable": true,
"typescript.validate.enable": true,
"javascript.validate.enable": false,
"redhat.telemetry.enabled": false,
"workbench.colorTheme": "One Dark Pro Darker",
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"terminal.integrated.fontFamily": "monospace",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"java.imports.gradle.wrapper.checksums": [
{
"sha256": "e2b82129ab64751fd40437007bd2f7f2afb3c6e41a9198e628650b22d5824a14",
"allowed": false
}
],
"[swift]": {
"editor.defaultFormatter": "vknabel.vscode-swiftformat"
},
"[java]": {
"editor.defaultFormatter": "redhat.java"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"npm.packageManager": "npm",
"diffEditor.ignoreTrimWhitespace": false,
"sql-formatter.uppercase": true,
"[sql]": {
"editor.defaultFormatter": "adpyke.vscode-sql-formatter"
},
"cSpell.userWords": [
"Balda",
"Bootloader",
"Framebuffer",
"glsl",
"LUNARG",
"pwhash",
"Rasterization",
"rasterized",
"Signup",
"swapchain",
"totp",
"Vulkan"
],
"lldb.library": "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB",
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"window.zoomLevel": -1,
"glsllint.glslifyUseCurrentFileAsBasedir": true,
"glsllint.glslifyAutoOpenOnError": false,
"glsllint.linkShader": false,
"[glsl]": {
"editor.defaultFormatter": "xaver.clang-format"
},
"editor.quickSuggestions": {
"strings": true
},
"editor.inlineSuggest.enabled": true,
"css.validate": false,
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}

@bradlc
Copy link
Contributor

bradlc commented Dec 13, 2022

Thank you! I'm pretty sure your files.exclude config is malformed, which is causing the issue. I'm getting a similar error from GitHub Copilot with your config:

CleanShot 2022-12-13 at 15 15 16@2x

Here's how I think you meant to configure it:

  "files.exclude": {
-   "\"**/*.js\": { \"when\": \"$(basename).ts\" }": true,
+   "**/*.js": { "when": "$(basename).ts" },
    "**/.classpath": true,
    "**/.project": true,
    "**/.settings": true,
    "**/.factorypath": true
  }

Can you confirm whether this fixes your issue?

@fbalda
Copy link
Author

fbalda commented Dec 13, 2022

It does indeed, thank you!
Interestingly I am pretty sure this was configured by some plugin (as I rarely work with globs) and it never caused any issues for me, leading me to assume my config was valid.
Sorry for the inconvenience and thank you for your work. Closing this

@fbalda fbalda closed this Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On some project (too many files) intellisense doesn't work
2 participants