Skip to content
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

Saving file causes LSP to shit the bed #1094

Closed
bbrk24 opened this issue Mar 12, 2024 · 10 comments
Closed

Saving file causes LSP to shit the bed #1094

bbrk24 opened this issue Mar 12, 2024 · 10 comments
Labels
lsp Language Server Protocol or other VSCode issues

Comments

@bbrk24
Copy link
Contributor

bbrk24 commented Mar 12, 2024

image

image

image

I have no idea where to begin with this one. Restarting the LSP only fixes it until I save again.

@edemaine edemaine added the lsp Language Server Protocol or other VSCode issues label Mar 12, 2024
@edemaine
Copy link
Collaborator

edemaine commented Mar 12, 2024

Can you post a repo where this happens consistently or at least inconsistently?

@bbrk24
Copy link
Contributor Author

bbrk24 commented Mar 12, 2024

https://github.com/bbrk24/mariokart-optimizer is where this is happening to me

@bbrk24
Copy link
Contributor Author

bbrk24 commented Mar 14, 2024

This also causes a more severe version of #825 -- document.que autocompletes to document.this.querySelector.

@bbrk24
Copy link
Contributor Author

bbrk24 commented Mar 21, 2024

In the past, DOM APIs would still have the correct types and tooltips (or, as correct as they could be without arrays). However, today I got this:
image

@bbrk24
Copy link
Contributor Author

bbrk24 commented Apr 2, 2024

Saving a file isn't the only trigger. If "jump to definition" opens one of the built-in lib.*.d.ts files, that can also trigger this.

@bbrk24
Copy link
Contributor Author

bbrk24 commented May 11, 2024

Simply having a lib.*.d.ts file open in another tab and performing an edit can trigger this. This is ridiculous.

@bbrk24
Copy link
Contributor Author

bbrk24 commented May 11, 2024

Here's the Language Server output, if that helps. It doesn't seem to suggest anything out of the ordinary:

Civet LSP Output
Init /home/bbrk24/workspace/NewSolitaire/
open file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
onDidChangeContent file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
Spawning language server for project path:  file:///home/bbrk24/workspace/NewSolitaire/
CIVET VSCODE PLUGIN 0.3.15
TYPESCRIPT 5.2.2
PARSED TSCONFIG
 {
  options: {
    lib: [ 'lib.dom.d.ts', 'lib.es2022.d.ts' ],
    target: 9,
    strict: true,
    configFilePath: '/home/bbrk24/workspace/NewSolitaire/tsconfig.json',
    rootDir: '/home/bbrk24/workspace/NewSolitaire/',
    allowNonTsExtensions: true,
    allowJs: true,
    jsx: 1
  },
  watchOptions: undefined,
  fileNames: [
    '/home/bbrk24/workspace/NewSolitaire/dist/Card.js',
    '/home/bbrk24/workspace/NewSolitaire/dist/Engine.js',
    '/home/bbrk24/workspace/NewSolitaire/dist/GameBoard.js',
    '/home/bbrk24/workspace/NewSolitaire/dist/WeakArray.js',
    '/home/bbrk24/workspace/NewSolitaire/dist/fisherYatesShuffle.js',
    '/home/bbrk24/workspace/NewSolitaire/dist/index.js',
    '/home/bbrk24/workspace/NewSolitaire/dist/interfaces.js'
  ],
  projectReferences: undefined,
  typeAcquisition: { enable: false, include: [], exclude: [] },
  raw: {
    compilerOptions: { lib: [Array], target: 'ES2022', strict: true },
    compileOnSave: false
  },
  errors: [],
  wildcardDirectories: { '/home/bbrk24/workspace/NewSolitaire': 1 },
  compileOnSave: false
} 

LOADED PROJECT CIVET 0.7.8: file:/home/bbrk24/workspace/NewSolitaire/@danielx/civet

executeQueue 1
Updating diagnostics for doc: file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
service.getSyntacticDiagnostics 810.32ms
service.getSemanticDiagnostics 196.20ms
service.getSuggestionDiagnostics 2.65ms
No Civet config found
onDidChangeContent file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
executeQueue 1
Updating diagnostics for doc: file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
service.getSyntacticDiagnostics 118.26ms
service.getSemanticDiagnostics 186.51ms
service.getSuggestionDiagnostics 3.68ms
onDidChangeContent file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
executeQueue 1
Updating diagnostics for doc: file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
service.getSyntacticDiagnostics 10.77ms
service.getSemanticDiagnostics 121.41ms
service.getSuggestionDiagnostics 1.43ms
onDidChangeContent file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
executeQueue 1
Updating diagnostics for doc: file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
service.getSyntacticDiagnostics 9.53ms
service.getSemanticDiagnostics 128.81ms
service.getSuggestionDiagnostics 1.74ms
onDidChangeContent file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
executeQueue 1
Updating diagnostics for doc: file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
service.getSyntacticDiagnostics 7.43ms
service.getSemanticDiagnostics 73.03ms
service.getSuggestionDiagnostics 2.26ms
onDidChangeContent file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
executeQueue 1
Updating diagnostics for doc: file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
service.getSyntacticDiagnostics 8.98ms
service.getSemanticDiagnostics 111.10ms
service.getSuggestionDiagnostics 3.22ms
onDidChangeContent file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
executeQueue 1
Updating diagnostics for doc: file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
service.getSyntacticDiagnostics 11.34ms
service.getSemanticDiagnostics 77.82ms
service.getSuggestionDiagnostics 10.13ms
open file:///home/bbrk24/.vscode-server/extensions/danielx.civet-0.3.15/dist/lib/lib.dom.d.ts
onDidChangeContent file:///home/bbrk24/.vscode-server/extensions/danielx.civet-0.3.15/dist/lib/lib.dom.d.ts
close file:///home/bbrk24/.vscode-server/extensions/danielx.civet-0.3.15/dist/lib/lib.dom.d.ts
executeQueue 1
Updating diagnostics for doc: file:///home/bbrk24/.vscode-server/extensions/danielx.civet-0.3.15/dist/lib/lib.dom.d.ts
service.getSyntacticDiagnostics 303.10ms
service.getSemanticDiagnostics 664.54ms
service.getSuggestionDiagnostics 54.14ms
Updating diagnostics for doc: file:///home/bbrk24/workspace/NewSolitaire/src/index.civet
service.getSyntacticDiagnostics 0.38ms
service.getSemanticDiagnostics 79.50ms
service.getSuggestionDiagnostics 1.48ms

No idea why it says TS 5.2.2, given that my package.json has

  "dependencies": {
    "@danielx/civet": "~0.7.8",
    "typescript": "~5.4.5"
  }

npm ls confirms I have 5.4:

$ npm ls typescript
NewSolitaire@ /home/bbrk24/workspace/NewSolitaire
├─┬ @danielx/[email protected]
│ └── [email protected] deduped
└── [email protected]

@bbrk24
Copy link
Contributor Author

bbrk24 commented Oct 11, 2024

I'm now experiencing a limited form of this that only complains about new properties:
image
image

This project's tsconfig, for reference:

{
    "compilerOptions": {
        "strict": true,
        "lib": ["ES2023", "ESNext.Regexp"],
        "target": "ESNext",
        "module": "ES2022"
    }
}

@bbrk24
Copy link
Contributor Author

bbrk24 commented Oct 15, 2024

Some more information I realized this morning: Even though it usually only affects core JS types like Array and Error, not DOM APIs, this only ever happens to its fullest extent in projects where I have "lib": ["DOM", ...] in my tsconfig. Node-only projects, like the one I mentioned in the previous comment, only ever complain about things that were added in relatively newer versions of JavaScript.

@bbrk24
Copy link
Contributor Author

bbrk24 commented Oct 16, 2024

As best as I can tell, this is no longer an issue in extension version 0.3.21.

@bbrk24 bbrk24 closed this as completed Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lsp Language Server Protocol or other VSCode issues
Projects
None yet
Development

No branches or pull requests

2 participants