Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
nighca committed Jan 14, 2025
1 parent 67585f6 commit d4b5214
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 26 deletions.
13 changes: 12 additions & 1 deletion spx-gui/src/components/editor/code-editor/ui/CodeEditorUI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@ export function useCodeEditorUICtx() {
</script>

<script setup lang="ts">
import { type InjectionKey, inject, provide, ref, watchEffect, shallowRef, watch, computed, onDeactivated, onActivated } from 'vue'
import {
type InjectionKey,
inject,
provide,
ref,
watchEffect,
shallowRef,
watch,
computed,
onDeactivated,
onActivated
} from 'vue'
import { computedShallowReactive, untilNotNull, useLocalStorage } from '@/utils/utils'
import { getCleanupSignal } from '@/utils/disposable'
import { theme, tabSize, insertSpaces } from '@/utils/spx/highlighter'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,20 @@ const categoriesComputed = computed(() => {
return result
})
// Initially display only items of the first category to improve initial rendering performance.
// After a delay, display all items. Delay exists only for the first update (from empty to non-empty).
// Initially display only items of the first category to improve rendering performance. After a delay, display all items.
// Delay is applied only for the first update (from empty to non-empty).
const categoriesForItems = shallowRef(categoriesComputed.value)
watch(
categoriesComputed,
(categories, _, onCleanUp) => {
if (categoriesForItems.value.length > 0) {
categoriesForItems.value = categories
return
}
categoriesForItems.value = categories.slice(0, 1)
const id = requestIdleCallback(() => {
categoriesForItems.value = categories
})
onCleanUp(() => cancelIdleCallback(id))
watch(categoriesComputed, (categories, _, onCleanUp) => {
if (categoriesForItems.value.length > 0) {
categoriesForItems.value = categories
return
}
)
categoriesForItems.value = categories.slice(0, 1)
const id = requestIdleCallback(() => {
categoriesForItems.value = categories
})
onCleanUp(() => cancelIdleCallback(id))
})
const activeCategoryIdRef = ref<string | null>(null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ export class DiagnosticsController extends Disposable {
)
)

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

this.addDisposer(watch(
() => this.ui.project.filesHash,
() => refreshItems(),
{ immediate: true }
))
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 d4b5214

Please sign in to comment.