Skip to content

Commit

Permalink
refresh LS result on project change
Browse files Browse the repository at this point in the history
  • Loading branch information
nighca committed Jan 10, 2025
1 parent 700dcad commit a21e9b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
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

0 comments on commit a21e9b2

Please sign in to comment.