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

"Problems" still reported after file is deleted or moved #1886

Open
1 task
bgdnlp opened this issue Nov 30, 2024 · 1 comment
Open
1 task

"Problems" still reported after file is deleted or moved #1886

bgdnlp opened this issue Nov 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@bgdnlp
Copy link

bgdnlp commented Nov 30, 2024

Extension Version

v2.34.0

VS Code Version

Version: 1.95.3 (Universal)
Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813
Date: 2024-11-13T14:50:04.152Z
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Darwin arm64 24.1.0

Operating System

macOS Sequoia 15.1.1

Terraform Version

1.9

Steps to Reproduce

  1. Create a new .tf file
  2. Write some invalid code
    variable {
      default = var.other
    }
    
  3. Delete the file

Expected Behavior

No more problems reported for that file.

Actual Behavior

Problems still reported.

Terraform Configuration

No response

Project Structure

No response

Gist

No response

Anything Else?

Might be related to the fact that problems are still reported even after a file is closed? Clearing problems when file is closed would work even better IMHO.

Workarounds

No response

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@bgdnlp bgdnlp added the bug Something isn't working label Nov 30, 2024
@dbanck
Copy link
Member

dbanck commented Dec 2, 2024

Hi @bgdnlp,

Thanks for the report! I'm able to reproduce the issue.

It looks like we're detecting the file deletion, reparsing the directory and publishing a new set of diagnostics as expected.

Here is the log output of variables.tf being deleted.

2024/12/02 16:49:00 rpc_logger.go:32: Incoming notification for "textDocument/didClose": {"textDocument":{"uri":"file:///Users/daniel.banck/tmp/issue1886/variables.tf"}}
2024/12/02 16:49:00 rpc_logger.go:32: Incoming request for "textDocument/documentLink" (ID 25): {"textDocument":{"uri":"file:///Users/daniel.banck/tmp/issue1886/main.tf"}}
2024/12/02 16:49:00 rpc_logger.go:53: Response to "textDocument/documentLink" (ID 25): []
2024/12/02 16:49:00 rpc_logger.go:32: Incoming request for "textDocument/codeLens" (ID 26): {"textDocument":{"uri":"file:///Users/daniel.banck/tmp/issue1886/main.tf"}}
2024/12/02 16:49:00 rpc_logger.go:53: Response to "textDocument/codeLens" (ID 26): []
2024/12/02 16:49:00 rpc_logger.go:32: Incoming request for "textDocument/semanticTokens/full" (ID 27): {"textDocument":{"uri":"file:///Users/daniel.banck/tmp/issue1886/main.tf"}}
2024/12/02 16:49:00 rpc_logger.go:32: Incoming request for "textDocument/documentSymbol" (ID 28): {"textDocument":{"uri":"file:///Users/daniel.banck/tmp/issue1886/main.tf"}}
2024/12/02 16:49:00 rpc_logger.go:53: Response to "textDocument/semanticTokens/full" (ID 27): {"data":[]}
2024/12/02 16:49:00 rpc_logger.go:32: Incoming notification for "workspace/didChangeWatchedFiles": {"changes":[{"uri":"file:///Users/daniel.banck/tmp/issue1886/variables.tf","type":3}]}
2024/12/02 16:49:00 did_change_watched_files.go:20: Received changes '\x01'
2024/12/02 16:49:00 did_change_watched_files.go:23: Received change event for '\x03': file:///Users/daniel.banck/tmp/issue1886/variables.tf
2024/12/02 16:49:00 did_change_watched.go:32: bus: -> DidChangeWatched /Users/daniel.banck/tmp/issue1886/variables.tf
2024/12/02 16:49:00 jobs.go:140: JOBS: Enqueueing new job "41": "OpTypeParseModuleConfiguration" for {"file:///Users/daniel.banck/tmp/issue1886"} (IsDirOpen: true, IgnoreState: true)
2024/12/02 16:49:00 jobs.go:140: JOBS: Enqueueing new job "42": "OpTypeLoadModuleMetadata" for {"file:///Users/daniel.banck/tmp/issue1886"} (IsDirOpen: true, IgnoreState: true)
2024/12/02 16:49:00 jobs.go:140: JOBS: Enqueueing new job "43": "OpTypeGetModuleDataFromRegistry" for {"file:///Users/daniel.banck/tmp/issue1886"} (IsDirOpen: true, IgnoreState: false)
2024/12/02 16:49:00 jobs.go:345: JOBS: Dispatching next job "41" (scheduler prio: 1, job prio: 0, isDirOpen: true): "OpTypeParseModuleConfiguration" for {"file:///Users/daniel.banck/tmp/issue1886"}
2024/12/02 16:49:00 jobs.go:487: JOBS: Finishing job "41": "OpTypeParseModuleConfiguration" for {"file:///Users/daniel.banck/tmp/issue1886"} (err = %!s(<nil>), deferredJobs: [])
2024/12/02 16:49:00 jobs.go:345: JOBS: Dispatching next job "42" (scheduler prio: 1, job prio: 0, isDirOpen: true): "OpTypeLoadModuleMetadata" for {"file:///Users/daniel.banck/tmp/issue1886"}
2024/12/02 16:49:00 jobs.go:140: JOBS: Enqueueing new job "44": "OpTypePreloadEmbeddedSchema" for {"file:///Users/daniel.banck/tmp/issue1886"} (IsDirOpen: true, IgnoreState: true)
2024/12/02 16:49:00 jobs.go:140: JOBS: Enqueueing new job "45": "OpTypeDecodeReferenceTargets" for {"file:///Users/daniel.banck/tmp/issue1886"} (IsDirOpen: true, IgnoreState: true)
2024/12/02 16:49:00 jobs.go:140: JOBS: Enqueueing new job "46": "OpTypeDecodeReferenceOrigins" for {"file:///Users/daniel.banck/tmp/issue1886"} (IsDirOpen: true, IgnoreState: true)
2024/12/02 16:49:00 jobs.go:140: JOBS: Enqueueing new job "47": "OpTypeSchemaModuleValidation" for {"file:///Users/daniel.banck/tmp/issue1886"} (IsDirOpen: true, IgnoreState: true)
2024/12/02 16:49:00 jobs.go:140: JOBS: Enqueueing new job "48": "OpTypeReferenceValidation" for {"file:///Users/daniel.banck/tmp/issue1886"} (IsDirOpen: true, IgnoreState: true)
2024/12/02 16:49:00 jobs.go:487: JOBS: Finishing job "42": "OpTypeLoadModuleMetadata" for {"file:///Users/daniel.banck/tmp/issue1886"} (err = %!s(<nil>), deferredJobs: ["44" "45" "46"])
2024/12/02 16:49:00 jobs.go:345: JOBS: Dispatching next job "44" (scheduler prio: 1, job prio: 0, isDirOpen: true): "OpTypePreloadEmbeddedSchema" for {"file:///Users/daniel.banck/tmp/issue1886"}
2024/12/02 16:49:00 jobs.go:487: JOBS: Finishing job "44": "OpTypePreloadEmbeddedSchema" for {"file:///Users/daniel.banck/tmp/issue1886"} (err = %!s(<nil>), deferredJobs: [])
2024/12/02 16:49:00 jobs.go:345: JOBS: Dispatching next job "45" (scheduler prio: 1, job prio: 0, isDirOpen: true): "OpTypeDecodeReferenceTargets" for {"file:///Users/daniel.banck/tmp/issue1886"}
2024/12/02 16:49:00 jobs.go:345: JOBS: Dispatching next job "43" (scheduler prio: -1, job prio: -1, isDirOpen: true): "OpTypeGetModuleDataFromRegistry" for {"file:///Users/daniel.banck/tmp/issue1886"}
2024/12/02 16:49:00 jobs.go:487: JOBS: Finishing job "43": "OpTypeGetModuleDataFromRegistry" for {"file:///Users/daniel.banck/tmp/issue1886"} (err = %!s(<nil>), deferredJobs: [])
2024/12/02 16:49:00 jobs.go:487: JOBS: Finishing job "45": "OpTypeDecodeReferenceTargets" for {"file:///Users/daniel.banck/tmp/issue1886"} (err = %!s(<nil>), deferredJobs: [])
2024/12/02 16:49:00 jobs.go:345: JOBS: Dispatching next job "46" (scheduler prio: 1, job prio: 0, isDirOpen: true): "OpTypeDecodeReferenceOrigins" for {"file:///Users/daniel.banck/tmp/issue1886"}
2024/12/02 16:49:00 jobs.go:487: JOBS: Finishing job "46": "OpTypeDecodeReferenceOrigins" for {"file:///Users/daniel.banck/tmp/issue1886"} (err = %!s(<nil>), deferredJobs: [])
2024/12/02 16:49:00 jobs.go:345: JOBS: Dispatching next job "47" (scheduler prio: 1, job prio: 0, isDirOpen: true): "OpTypeSchemaModuleValidation" for {"file:///Users/daniel.banck/tmp/issue1886"}
2024/12/02 16:49:00 jobs.go:487: JOBS: Finishing job "47": "OpTypeSchemaModuleValidation" for {"file:///Users/daniel.banck/tmp/issue1886"} (err = %!s(<nil>), deferredJobs: [])
2024/12/02 16:49:00 jobs.go:345: JOBS: Dispatching next job "48" (scheduler prio: 1, job prio: 0, isDirOpen: true): "OpTypeReferenceValidation" for {"file:///Users/daniel.banck/tmp/issue1886"}
2024/12/02 16:49:00 jobs.go:487: JOBS: Finishing job "48": "OpTypeReferenceValidation" for {"file:///Users/daniel.banck/tmp/issue1886"} (err = %!s(<nil>), deferredJobs: [])
2024/12/02 16:49:00 opts.go:215: Posting server notification "textDocument/publishDiagnostics" {"uri":"file:///Users/daniel.banck/tmp/issue1886","diagnostics":[]}
2024/12/02 16:49:00 opts.go:215: Posting server notification "textDocument/publishDiagnostics" {"uri":"file:///Users/daniel.banck/tmp/issue1886/main.tf","diagnostics":[]}

The language server doesn't publish diagnostics for variables.tf anymore, because the file has been deleted and removed from our internal state. But the client keeps the diagnostics in the UI until they are cleared (or overwritten) by the language server.

Proposal

  • Investigate whether we need to clear the diagnostics before removing a file from state, or if we can clear the diagnostics for the whole module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants