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

Refresh LS result on project change #1233

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions spx-gui/src/components/editor/code-editor/ui/diagnostics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,6 @@ export class DiagnosticsController extends Disposable {
init() {
const refreshDiagnostics = debounce(() => this.diagnosticsMgr.start(), 100)

this.addDisposer(
watch(
() => this.ui.activeTextDocument,
(textDocument, _, onCleanup) => {
if (textDocument == null) return
refreshDiagnostics()
onCleanup(textDocument.on('didChangeContent', refreshDiagnostics))
},
{ immediate: true }
)
)
this.addDisposer(
watch(
this.providerRef,
Expand All @@ -63,5 +52,11 @@ export class DiagnosticsController extends Disposable {
{ immediate: true }
)
)

this.addDisposer(watch(
() => this.ui.project.filesHash,
() => refreshDiagnostics(),
{ immediate: true }
))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,6 @@ export class ResourceReferenceController extends Emitter<{

const refreshItems = debounce(() => this.itemsMgr.start(), 100)

this.addDisposer(
watch(
() => this.ui.activeTextDocument,
(textDocument, _, onCleanup) => {
if (textDocument == null) return
refreshItems()
onCleanup(textDocument.on('didChangeContent', refreshItems))
},
{ immediate: true }
)
)
this.addDisposer(
watch(
this.providerRef,
Expand All @@ -118,6 +107,12 @@ export class ResourceReferenceController extends Emitter<{
)
)

this.addDisposer(watch(
() => this.ui.project.filesHash,
() => refreshItems(),
{ immediate: true }
))

const editorEl = editor.getDomNode()
if (editorEl == null) throw new Error('No editor dom node')

Expand Down
Loading