Skip to content

Commit b092e33

Browse files
lint fix
1 parent 1c48b70 commit b092e33

File tree

7 files changed

+116
-7
lines changed

7 files changed

+116
-7
lines changed

src/main/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const getSettings = () => {
6868
stackedDump: settingsJson.stackedDump || defaultSettings.stackedDump,
6969
windowWidth: settingsJson.windowWidth || defaultSettings.windowWidth,
7070
windowHeight: settingsJson.windowHeight || defaultSettings.windowHeight,
71-
intelephenseLicenseKey: settingsJson.intelephenseLicenseKey || ''
71+
intelephenseLicenseKey: settingsJson.intelephenseLicenseKey || '',
7272
}
7373
} else {
7474
settings = defaultSettings

src/renderer/components/Editor.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,13 @@
330330
'**/node_modules/**',
331331
'**/vendor/**/{Tests,tests}/**',
332332
'**/vendor/**/vendor/**',
333-
]
333+
],
334334
},
335335
},
336336
errorHandler: {
337337
error: () => ({ action: ErrorAction.Continue }),
338338
closed: () => ({ action: CloseAction.DoNotRestart }),
339-
}
339+
},
340340
},
341341
connectionProvider: {
342342
get: () => Promise.resolve(messageTransports),

src/renderer/components/Toast.vue

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<script setup lang="ts">
2+
import { computed } from 'vue'
3+
import { useToastStore } from '@/stores/toast'
4+
5+
const toast = useToastStore()
6+
7+
const isVisible = computed(() => !!toast.message)
8+
9+
const accentColor = computed(() => {
10+
switch (toast.type) {
11+
case 'error':
12+
return 'var(--vscode-inputValidation-errorBorder, var(--vscode-editorError-foreground, #f14c4c))'
13+
case 'warning':
14+
return 'var(--vscode-inputValidation-warningBorder, var(--vscode-editorWarning-foreground, #cca700))'
15+
case 'info':
16+
default:
17+
return 'var(--vscode-inputValidation-infoBorder, var(--vscode-editorInfo-foreground, #3794ff))'
18+
}
19+
})
20+
</script>
21+
22+
<template>
23+
<transition name="toast-fade-slide">
24+
<div
25+
v-if="isVisible"
26+
class="fixed z-[1000] right-4 bottom-4 max-w-md shadow-lg rounded border p-3 pr-8"
27+
:style="{
28+
backgroundColor: 'var(--vscode-editorWidget-background, #1e1e1e)',
29+
color: 'var(--vscode-editor-foreground, #cccccc)',
30+
borderColor: 'var(--vscode-editorWidget-border, rgba(128,128,128,0.3))',
31+
boxShadow: '0 8px 24px rgba(0,0,0,0.24), 0 1px 2px rgba(0,0,0,0.4)',
32+
}"
33+
role="status"
34+
aria-live="polite"
35+
>
36+
<div class="flex items-start gap-2">
37+
<span class="mt-[3px] inline-block w-1 h-5 rounded" :style="{ backgroundColor: accentColor }"></span>
38+
<div class="text-sm select-text whitespace-pre-line">{{ toast.message }}</div>
39+
</div>
40+
41+
<button
42+
class="absolute top-2 right-2 w-6 h-6 flex items-center justify-center rounded hover:opacity-80"
43+
:style="{
44+
color: 'var(--vscode-icon-foreground, var(--vscode-editor-foreground, #cccccc))',
45+
background: 'transparent',
46+
}"
47+
aria-label="Close notification"
48+
@click="toast.close()"
49+
>
50+
×
51+
</button>
52+
</div>
53+
</transition>
54+
</template>
55+
56+
<style scoped>
57+
.toast-fade-slide-enter-active,
58+
.toast-fade-slide-leave-active {
59+
transition: all 150ms ease;
60+
}
61+
.toast-fade-slide-enter-from,
62+
.toast-fade-slide-leave-to {
63+
opacity: 0;
64+
transform: translateY(6px);
65+
}
66+
</style>

src/renderer/stores/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const useSettingsStore = defineStore('settings', () => {
4646
stackedDump: 'extended',
4747
windowWidth: 1100,
4848
windowHeight: 700,
49-
intelephenseLicenseKey: ''
49+
intelephenseLicenseKey: '',
5050
}
5151

5252
const settings = ref<Settings>(defaultSettings)

src/renderer/stores/toast.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { defineStore } from 'pinia'
2+
3+
export type ToastType = 'info' | 'warning' | 'error'
4+
5+
interface ToastState {
6+
message: string | null
7+
type: ToastType
8+
timeoutId: number | null
9+
}
10+
11+
export const useToastStore = defineStore('toast', {
12+
state: (): ToastState => ({
13+
message: null,
14+
type: 'info',
15+
timeoutId: null,
16+
}),
17+
actions: {
18+
show(message: string, type: ToastType = 'info', durationMs?: number) {
19+
// Only one toast at a time; replace existing and reset timer
20+
this.message = message
21+
this.type = type
22+
23+
if (this.timeoutId) {
24+
clearTimeout(this.timeoutId)
25+
this.timeoutId = null
26+
}
27+
28+
if (durationMs && durationMs > 0) {
29+
this.timeoutId = window.setTimeout(() => {
30+
this.close()
31+
}, durationMs)
32+
}
33+
},
34+
close() {
35+
if (this.timeoutId) {
36+
clearTimeout(this.timeoutId)
37+
this.timeoutId = null
38+
}
39+
this.message = null
40+
},
41+
},
42+
})

src/renderer/views/CodeView.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@
7070
try {
7171
// @ts-ignore - template ref typed at runtime
7272
codeEditor?.value?.reconnectLsp && codeEditor.value.reconnectLsp()
73-
} catch (e) {
74-
}
73+
} catch (e) {}
7574
}
7675
}
7776

src/renderer/views/settings/GeneralSettings.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@
9797
placeholder="Optional — paste your license to enable premium features"
9898
autocomplete="off"
9999
/>
100-
<span class="text-[11px] opacity-60">Leave empty to use the free version. Changes restart the PHP language server.</span>
100+
<span class="text-[11px] opacity-60"
101+
>Leave empty to use the free version. Changes restart the PHP language server.</span
102+
>
101103
</div>
102104
</div>
103105
<Divider class="mt-3" />

0 commit comments

Comments
 (0)