@nocturnium/svelte-ide 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +251 -0
- package/dist/components/agents/AgentActivityPanel.svelte +565 -0
- package/dist/components/agents/AgentActivityPanel.svelte.d.ts +24 -0
- package/dist/components/agents/AgentAvatar.svelte +417 -0
- package/dist/components/agents/AgentAvatar.svelte.d.ts +23 -0
- package/dist/components/agents/AgentCursor.svelte +224 -0
- package/dist/components/agents/AgentCursor.svelte.d.ts +35 -0
- package/dist/components/agents/AgentPresenceBar.svelte +261 -0
- package/dist/components/agents/AgentPresenceBar.svelte.d.ts +20 -0
- package/dist/components/agents/index.d.ts +4 -0
- package/dist/components/agents/index.js +5 -0
- package/dist/components/ai/AIConversationList.svelte +524 -0
- package/dist/components/ai/AIConversationList.svelte.d.ts +17 -0
- package/dist/components/ai/AIEditPreview.svelte +132 -0
- package/dist/components/ai/AIEditPreview.svelte.d.ts +8 -0
- package/dist/components/ai/AIInlineEdit.svelte +155 -0
- package/dist/components/ai/AIInlineEdit.svelte.d.ts +10 -0
- package/dist/components/ai/AIMessage.svelte +239 -0
- package/dist/components/ai/AIMessage.svelte.d.ts +13 -0
- package/dist/components/ai/AIMessageActions.svelte +176 -0
- package/dist/components/ai/AIMessageActions.svelte.d.ts +12 -0
- package/dist/components/ai/AIMessageContent.svelte +355 -0
- package/dist/components/ai/AIMessageContent.svelte.d.ts +7 -0
- package/dist/components/ai/AIPanel.svelte +561 -0
- package/dist/components/ai/AIPanel.svelte.d.ts +7 -0
- package/dist/components/ai/AISuggestionWidget.svelte +132 -0
- package/dist/components/ai/AISuggestionWidget.svelte.d.ts +10 -0
- package/dist/components/ai/AIToolCallDisplay.svelte +317 -0
- package/dist/components/ai/AIToolCallDisplay.svelte.d.ts +12 -0
- package/dist/components/ai/index.d.ts +9 -0
- package/dist/components/ai/index.js +10 -0
- package/dist/components/core/Avatar.svelte +110 -0
- package/dist/components/core/Avatar.svelte.d.ts +12 -0
- package/dist/components/core/Badge.svelte +98 -0
- package/dist/components/core/Badge.svelte.d.ts +11 -0
- package/dist/components/core/Button.svelte +175 -0
- package/dist/components/core/Button.svelte.d.ts +18 -0
- package/dist/components/core/ConnectionStatus.svelte +294 -0
- package/dist/components/core/ConnectionStatus.svelte.d.ts +20 -0
- package/dist/components/core/ContextMenu.svelte +176 -0
- package/dist/components/core/ContextMenu.svelte.d.ts +19 -0
- package/dist/components/core/ErrorBoundary.svelte +277 -0
- package/dist/components/core/ErrorBoundary.svelte.d.ts +23 -0
- package/dist/components/core/Icon.svelte +107 -0
- package/dist/components/core/Icon.svelte.d.ts +8 -0
- package/dist/components/core/Input.svelte +138 -0
- package/dist/components/core/Input.svelte.d.ts +20 -0
- package/dist/components/core/Kbd.svelte +34 -0
- package/dist/components/core/Kbd.svelte.d.ts +7 -0
- package/dist/components/core/ResizeHandle.svelte +200 -0
- package/dist/components/core/ResizeHandle.svelte.d.ts +23 -0
- package/dist/components/core/Spinner.svelte +35 -0
- package/dist/components/core/Spinner.svelte.d.ts +7 -0
- package/dist/components/core/Textarea.svelte +112 -0
- package/dist/components/core/Textarea.svelte.d.ts +18 -0
- package/dist/components/core/Tooltip.svelte +103 -0
- package/dist/components/core/Tooltip.svelte.d.ts +11 -0
- package/dist/components/core/index.d.ts +13 -0
- package/dist/components/core/index.js +14 -0
- package/dist/components/editor/AIFocusLayer.svelte +430 -0
- package/dist/components/editor/AIFocusLayer.svelte.d.ts +32 -0
- package/dist/components/editor/Breadcrumbs.svelte +435 -0
- package/dist/components/editor/Breadcrumbs.svelte.d.ts +33 -0
- package/dist/components/editor/BreakpointLayer.svelte +642 -0
- package/dist/components/editor/BreakpointLayer.svelte.d.ts +20 -0
- package/dist/components/editor/CognitiveLoadMeter.svelte +324 -0
- package/dist/components/editor/CognitiveLoadMeter.svelte.d.ts +18 -0
- package/dist/components/editor/CollaborativeEditor.svelte +218 -0
- package/dist/components/editor/CollaborativeEditor.svelte.d.ts +32 -0
- package/dist/components/editor/CommandPalette.svelte +434 -0
- package/dist/components/editor/CommandPalette.svelte.d.ts +11 -0
- package/dist/components/editor/ComplexityLayer.svelte +293 -0
- package/dist/components/editor/ComplexityLayer.svelte.d.ts +23 -0
- package/dist/components/editor/ConflictZoneLayer.svelte +441 -0
- package/dist/components/editor/ConflictZoneLayer.svelte.d.ts +25 -0
- package/dist/components/editor/ContextLens.svelte +262 -0
- package/dist/components/editor/ContextLens.svelte.d.ts +27 -0
- package/dist/components/editor/CustomEditor.svelte +1242 -0
- package/dist/components/editor/CustomEditor.svelte.d.ts +37 -0
- package/dist/components/editor/DebugConsole.svelte +646 -0
- package/dist/components/editor/DebugConsole.svelte.d.ts +41 -0
- package/dist/components/editor/EchoCursorLayer.svelte +363 -0
- package/dist/components/editor/EchoCursorLayer.svelte.d.ts +24 -0
- package/dist/components/editor/Editor.svelte +61 -0
- package/dist/components/editor/Editor.svelte.d.ts +22 -0
- package/dist/components/editor/EditorGutter.svelte +119 -0
- package/dist/components/editor/EditorGutter.svelte.d.ts +19 -0
- package/dist/components/editor/EditorLines.svelte +182 -0
- package/dist/components/editor/EditorLines.svelte.d.ts +43 -0
- package/dist/components/editor/EditorPane.svelte +134 -0
- package/dist/components/editor/EditorPane.svelte.d.ts +9 -0
- package/dist/components/editor/EditorSelections.svelte +186 -0
- package/dist/components/editor/EditorSelections.svelte.d.ts +25 -0
- package/dist/components/editor/EditorTabs.svelte +170 -0
- package/dist/components/editor/EditorTabs.svelte.d.ts +12 -0
- package/dist/components/editor/FileExplorer.svelte +811 -0
- package/dist/components/editor/FileExplorer.svelte.d.ts +67 -0
- package/dist/components/editor/FileIcon.svelte +110 -0
- package/dist/components/editor/FileIcon.svelte.d.ts +10 -0
- package/dist/components/editor/FindReplace.svelte +448 -0
- package/dist/components/editor/FindReplace.svelte.d.ts +40 -0
- package/dist/components/editor/GhostBracketLayer.svelte +391 -0
- package/dist/components/editor/GhostBracketLayer.svelte.d.ts +24 -0
- package/dist/components/editor/GitBlameLayer.svelte +436 -0
- package/dist/components/editor/GitBlameLayer.svelte.d.ts +18 -0
- package/dist/components/editor/InlineDiagnosticsLayer.svelte +540 -0
- package/dist/components/editor/InlineDiagnosticsLayer.svelte.d.ts +35 -0
- package/dist/components/editor/InlineDiffLayer.svelte +337 -0
- package/dist/components/editor/InlineDiffLayer.svelte.d.ts +31 -0
- package/dist/components/editor/MinimalEditor.svelte +75 -0
- package/dist/components/editor/MinimalEditor.svelte.d.ts +6 -0
- package/dist/components/editor/MinimalEditor2.svelte +84 -0
- package/dist/components/editor/MinimalEditor2.svelte.d.ts +6 -0
- package/dist/components/editor/Minimap.svelte +327 -0
- package/dist/components/editor/Minimap.svelte.d.ts +34 -0
- package/dist/components/editor/PluginPreviewSandbox.svelte +793 -0
- package/dist/components/editor/PluginPreviewSandbox.svelte.d.ts +49 -0
- package/dist/components/editor/ProblemsPanel.svelte +628 -0
- package/dist/components/editor/ProblemsPanel.svelte.d.ts +25 -0
- package/dist/components/editor/QuickActionsMenu.svelte +403 -0
- package/dist/components/editor/QuickActionsMenu.svelte.d.ts +18 -0
- package/dist/components/editor/SnippetPalette.svelte +530 -0
- package/dist/components/editor/SnippetPalette.svelte.d.ts +16 -0
- package/dist/components/editor/StructureMap.svelte +431 -0
- package/dist/components/editor/StructureMap.svelte.d.ts +37 -0
- package/dist/components/editor/SymbolOutline.svelte +722 -0
- package/dist/components/editor/SymbolOutline.svelte.d.ts +44 -0
- package/dist/components/editor/TimelineScrubber.svelte +470 -0
- package/dist/components/editor/TimelineScrubber.svelte.d.ts +40 -0
- package/dist/components/editor/TokenRenderer.svelte +69 -0
- package/dist/components/editor/TokenRenderer.svelte.d.ts +15 -0
- package/dist/components/editor/constants.d.ts +32 -0
- package/dist/components/editor/constants.js +36 -0
- package/dist/components/editor/core/ai-awareness.d.ts +176 -0
- package/dist/components/editor/core/ai-awareness.js +210 -0
- package/dist/components/editor/core/bracket-healer.d.ts +189 -0
- package/dist/components/editor/core/bracket-healer.js +406 -0
- package/dist/components/editor/core/breakpoints.d.ts +203 -0
- package/dist/components/editor/core/breakpoints.js +414 -0
- package/dist/components/editor/core/commands.d.ts +108 -0
- package/dist/components/editor/core/commands.js +246 -0
- package/dist/components/editor/core/complexity-analyzer.d.ts +123 -0
- package/dist/components/editor/core/complexity-analyzer.js +376 -0
- package/dist/components/editor/core/conflict-predictor.d.ts +135 -0
- package/dist/components/editor/core/conflict-predictor.js +316 -0
- package/dist/components/editor/core/crdt-binding.d.ts +118 -0
- package/dist/components/editor/core/crdt-binding.js +286 -0
- package/dist/components/editor/core/diagnostics.d.ts +210 -0
- package/dist/components/editor/core/diagnostics.js +335 -0
- package/dist/components/editor/core/echo-cursor.d.ts +201 -0
- package/dist/components/editor/core/echo-cursor.js +267 -0
- package/dist/components/editor/core/folding.d.ts +124 -0
- package/dist/components/editor/core/folding.js +672 -0
- package/dist/components/editor/core/ghost-pair.d.ts +122 -0
- package/dist/components/editor/core/ghost-pair.js +221 -0
- package/dist/components/editor/core/git-blame.d.ts +170 -0
- package/dist/components/editor/core/git-blame.js +324 -0
- package/dist/components/editor/core/index.d.ts +26 -0
- package/dist/components/editor/core/index.js +24 -0
- package/dist/components/editor/core/keybindings.d.ts +79 -0
- package/dist/components/editor/core/keybindings.js +357 -0
- package/dist/components/editor/core/multi-cursor.d.ts +196 -0
- package/dist/components/editor/core/multi-cursor.js +521 -0
- package/dist/components/editor/core/navigation.d.ts +107 -0
- package/dist/components/editor/core/navigation.js +408 -0
- package/dist/components/editor/core/quick-actions.d.ts +189 -0
- package/dist/components/editor/core/quick-actions.js +427 -0
- package/dist/components/editor/core/search.d.ts +88 -0
- package/dist/components/editor/core/search.js +192 -0
- package/dist/components/editor/core/semantic-analyzer.d.ts +77 -0
- package/dist/components/editor/core/semantic-analyzer.js +424 -0
- package/dist/components/editor/core/snippet-manager.d.ts +202 -0
- package/dist/components/editor/core/snippet-manager.js +565 -0
- package/dist/components/editor/core/state.d.ts +367 -0
- package/dist/components/editor/core/state.js +900 -0
- package/dist/components/editor/core/timeline.d.ts +204 -0
- package/dist/components/editor/core/timeline.js +349 -0
- package/dist/components/editor/editor-find.d.ts +56 -0
- package/dist/components/editor/editor-find.js +148 -0
- package/dist/components/editor/editor-input.d.ts +77 -0
- package/dist/components/editor/editor-input.js +445 -0
- package/dist/components/editor/editor-multicursor.d.ts +21 -0
- package/dist/components/editor/editor-multicursor.js +196 -0
- package/dist/components/editor/editor-scroll.d.ts +14 -0
- package/dist/components/editor/editor-scroll.js +34 -0
- package/dist/components/editor/index.d.ts +15 -0
- package/dist/components/editor/index.js +21 -0
- package/dist/components/editor/languages.d.ts +62 -0
- package/dist/components/editor/languages.js +285 -0
- package/dist/components/editor/theme.d.ts +88 -0
- package/dist/components/editor/theme.js +139 -0
- package/dist/components/editor/tokenizer/base.d.ts +40 -0
- package/dist/components/editor/tokenizer/base.js +203 -0
- package/dist/components/editor/tokenizer/index.d.ts +56 -0
- package/dist/components/editor/tokenizer/index.js +215 -0
- package/dist/components/editor/tokenizer/languages/css.d.ts +17 -0
- package/dist/components/editor/tokenizer/languages/css.js +194 -0
- package/dist/components/editor/tokenizer/languages/go.d.ts +17 -0
- package/dist/components/editor/tokenizer/languages/go.js +220 -0
- package/dist/components/editor/tokenizer/languages/html.d.ts +24 -0
- package/dist/components/editor/tokenizer/languages/html.js +145 -0
- package/dist/components/editor/tokenizer/languages/javascript.d.ts +56 -0
- package/dist/components/editor/tokenizer/languages/javascript.js +452 -0
- package/dist/components/editor/tokenizer/languages/json.d.ts +12 -0
- package/dist/components/editor/tokenizer/languages/json.js +91 -0
- package/dist/components/editor/tokenizer/languages/markdown.d.ts +16 -0
- package/dist/components/editor/tokenizer/languages/markdown.js +156 -0
- package/dist/components/editor/tokenizer/languages/python.d.ts +20 -0
- package/dist/components/editor/tokenizer/languages/python.js +227 -0
- package/dist/components/editor/tokenizer/languages/svelte.d.ts +40 -0
- package/dist/components/editor/tokenizer/languages/svelte.js +326 -0
- package/dist/components/editor/tokenizer/types.d.ts +86 -0
- package/dist/components/editor/tokenizer/types.js +4 -0
- package/dist/components/layout/IDELayout.svelte +274 -0
- package/dist/components/layout/IDELayout.svelte.d.ts +29 -0
- package/dist/components/layout/StatusBar.svelte +511 -0
- package/dist/components/layout/StatusBar.svelte.d.ts +47 -0
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/layout/index.js +3 -0
- package/dist/components/lsp/AutocompleteWidget.svelte +364 -0
- package/dist/components/lsp/AutocompleteWidget.svelte.d.ts +33 -0
- package/dist/components/lsp/DiagnosticMarker.svelte +166 -0
- package/dist/components/lsp/DiagnosticMarker.svelte.d.ts +19 -0
- package/dist/components/lsp/DiagnosticsPanel.svelte +388 -0
- package/dist/components/lsp/DiagnosticsPanel.svelte.d.ts +21 -0
- package/dist/components/lsp/HoverTooltip.svelte +274 -0
- package/dist/components/lsp/HoverTooltip.svelte.d.ts +24 -0
- package/dist/components/lsp/LSPEditor.svelte +486 -0
- package/dist/components/lsp/LSPEditor.svelte.d.ts +39 -0
- package/dist/components/lsp/SignatureHelpWidget.svelte +216 -0
- package/dist/components/lsp/SignatureHelpWidget.svelte.d.ts +22 -0
- package/dist/components/lsp/index.d.ts +6 -0
- package/dist/components/lsp/index.js +7 -0
- package/dist/components/plugins/PluginCard.svelte +153 -0
- package/dist/components/plugins/PluginCard.svelte.d.ts +19 -0
- package/dist/components/plugins/PluginPanel.svelte +280 -0
- package/dist/components/plugins/PluginPanel.svelte.d.ts +8 -0
- package/dist/components/plugins/PluginProposalForm.svelte +250 -0
- package/dist/components/plugins/PluginProposalForm.svelte.d.ts +6 -0
- package/dist/components/plugins/PluginStatusBadge.svelte +14 -0
- package/dist/components/plugins/PluginStatusBadge.svelte.d.ts +8 -0
- package/dist/components/plugins/index.d.ts +4 -0
- package/dist/components/plugins/index.js +5 -0
- package/dist/components/vfs/LockConflictDialog.svelte +705 -0
- package/dist/components/vfs/LockConflictDialog.svelte.d.ts +21 -0
- package/dist/components/vfs/LockIndicator.svelte +194 -0
- package/dist/components/vfs/LockIndicator.svelte.d.ts +29 -0
- package/dist/components/vfs/LockOverlay.svelte +344 -0
- package/dist/components/vfs/LockOverlay.svelte.d.ts +17 -0
- package/dist/components/vfs/VersionConflictDialog.svelte +549 -0
- package/dist/components/vfs/VersionConflictDialog.svelte.d.ts +24 -0
- package/dist/components/vfs/index.d.ts +4 -0
- package/dist/components/vfs/index.js +5 -0
- package/dist/crdt/awareness.d.ts +42 -0
- package/dist/crdt/awareness.js +109 -0
- package/dist/crdt/document.d.ts +101 -0
- package/dist/crdt/document.js +187 -0
- package/dist/crdt/index.d.ts +9 -0
- package/dist/crdt/index.js +8 -0
- package/dist/crdt/provider.d.ts +85 -0
- package/dist/crdt/provider.js +150 -0
- package/dist/crdt/types.d.ts +61 -0
- package/dist/crdt/types.js +4 -0
- package/dist/crdt/undo.d.ts +34 -0
- package/dist/crdt/undo.js +70 -0
- package/dist/index.d.ts +277 -0
- package/dist/index.js +280 -0
- package/dist/plugins/index.d.ts +103 -0
- package/dist/plugins/index.js +153 -0
- package/dist/services/error-handling.d.ts +95 -0
- package/dist/services/error-handling.js +413 -0
- package/dist/services/ide-integration.d.ts +83 -0
- package/dist/services/ide-integration.js +367 -0
- package/dist/services/lsp-client.d.ts +69 -0
- package/dist/services/lsp-client.js +667 -0
- package/dist/services/mock-ai.d.ts +37 -0
- package/dist/services/mock-ai.js +318 -0
- package/dist/services/optimistic.d.ts +141 -0
- package/dist/services/optimistic.js +367 -0
- package/dist/services/vfs-client.d.ts +81 -0
- package/dist/services/vfs-client.js +348 -0
- package/dist/stores/agents.svelte.d.ts +85 -0
- package/dist/stores/agents.svelte.js +459 -0
- package/dist/stores/ai-persistence.svelte.d.ts +76 -0
- package/dist/stores/ai-persistence.svelte.js +334 -0
- package/dist/stores/ai.svelte.d.ts +140 -0
- package/dist/stores/ai.svelte.js +383 -0
- package/dist/stores/collaboration.svelte.d.ts +164 -0
- package/dist/stores/collaboration.svelte.js +334 -0
- package/dist/stores/editor.svelte.d.ts +131 -0
- package/dist/stores/editor.svelte.js +250 -0
- package/dist/stores/index.d.ts +10 -0
- package/dist/stores/index.js +29 -0
- package/dist/stores/layout.svelte.d.ts +171 -0
- package/dist/stores/layout.svelte.js +351 -0
- package/dist/stores/plugin.svelte.d.ts +121 -0
- package/dist/stores/plugin.svelte.js +410 -0
- package/dist/stores/vfs.svelte.d.ts +123 -0
- package/dist/stores/vfs.svelte.js +680 -0
- package/dist/styles/theme.css +623 -0
- package/dist/types/agents.d.ts +127 -0
- package/dist/types/agents.js +5 -0
- package/dist/types/ai.d.ts +137 -0
- package/dist/types/ai.js +4 -0
- package/dist/types/crdt.d.ts +222 -0
- package/dist/types/crdt.js +5 -0
- package/dist/types/editor.d.ts +52 -0
- package/dist/types/editor.js +18 -0
- package/dist/types/events.d.ts +133 -0
- package/dist/types/events.js +4 -0
- package/dist/types/filesystem.d.ts +77 -0
- package/dist/types/filesystem.js +4 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.js +12 -0
- package/dist/types/lsp.d.ts +691 -0
- package/dist/types/lsp.js +108 -0
- package/dist/types/plugin.d.ts +239 -0
- package/dist/types/plugin.js +5 -0
- package/dist/types/vfs.d.ts +191 -0
- package/dist/types/vfs.js +18 -0
- package/dist/utils/format.d.ts +55 -0
- package/dist/utils/format.js +152 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/keybindings.d.ts +33 -0
- package/dist/utils/keybindings.js +171 -0
- package/dist/utils/language.d.ts +27 -0
- package/dist/utils/language.js +222 -0
- package/package.json +178 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diagnostics Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages code diagnostics including:
|
|
5
|
+
* - Errors, warnings, info, hints
|
|
6
|
+
* - Quick fixes and code actions
|
|
7
|
+
* - Diagnostic sources (TypeScript, ESLint, etc.)
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Diagnostics Manager
|
|
11
|
+
*/
|
|
12
|
+
export class DiagnosticsManager {
|
|
13
|
+
_config = {
|
|
14
|
+
enabled: true,
|
|
15
|
+
showInline: true,
|
|
16
|
+
showGutterIcons: true,
|
|
17
|
+
showDelay: 500,
|
|
18
|
+
maxPerFile: 100,
|
|
19
|
+
severityFilter: ['error', 'warning', 'info', 'hint']
|
|
20
|
+
};
|
|
21
|
+
_diagnostics = new Map();
|
|
22
|
+
_listeners = new Set();
|
|
23
|
+
_idCounter = 0;
|
|
24
|
+
/**
|
|
25
|
+
* Set diagnostics for a file
|
|
26
|
+
*/
|
|
27
|
+
setDiagnostics(filePath, diagnostics) {
|
|
28
|
+
const withIds = diagnostics.map((d) => ({
|
|
29
|
+
...d,
|
|
30
|
+
id: `diag-${++this._idCounter}`
|
|
31
|
+
}));
|
|
32
|
+
// Limit per file
|
|
33
|
+
const limited = withIds.slice(0, this._config.maxPerFile);
|
|
34
|
+
this._diagnostics.set(filePath, limited);
|
|
35
|
+
this.notify();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Add diagnostics to a file
|
|
39
|
+
*/
|
|
40
|
+
addDiagnostics(filePath, diagnostics) {
|
|
41
|
+
const existing = this._diagnostics.get(filePath) || [];
|
|
42
|
+
const withIds = diagnostics.map((d) => ({
|
|
43
|
+
...d,
|
|
44
|
+
id: `diag-${++this._idCounter}`
|
|
45
|
+
}));
|
|
46
|
+
const combined = [...existing, ...withIds].slice(0, this._config.maxPerFile);
|
|
47
|
+
this._diagnostics.set(filePath, combined);
|
|
48
|
+
this.notify();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Clear diagnostics for a file
|
|
52
|
+
*/
|
|
53
|
+
clearDiagnostics(filePath) {
|
|
54
|
+
this._diagnostics.delete(filePath);
|
|
55
|
+
this.notify();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Clear all diagnostics
|
|
59
|
+
*/
|
|
60
|
+
clearAll() {
|
|
61
|
+
this._diagnostics.clear();
|
|
62
|
+
this.notify();
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get diagnostics for a file
|
|
66
|
+
*/
|
|
67
|
+
getDiagnostics(filePath) {
|
|
68
|
+
const diagnostics = this._diagnostics.get(filePath) || [];
|
|
69
|
+
return this.filterDiagnostics(diagnostics);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get all diagnostics
|
|
73
|
+
*/
|
|
74
|
+
getAllDiagnostics() {
|
|
75
|
+
const filtered = new Map();
|
|
76
|
+
for (const [path, diagnostics] of this._diagnostics) {
|
|
77
|
+
const filteredDiags = this.filterDiagnostics(diagnostics);
|
|
78
|
+
if (filteredDiags.length > 0) {
|
|
79
|
+
filtered.set(path, filteredDiags);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return filtered;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get diagnostics at a specific position
|
|
86
|
+
*/
|
|
87
|
+
getDiagnosticsAtPosition(filePath, position) {
|
|
88
|
+
const diagnostics = this.getDiagnostics(filePath);
|
|
89
|
+
return diagnostics.filter((d) => this.positionInRange(position, d.range));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get diagnostics for a line
|
|
93
|
+
*/
|
|
94
|
+
getDiagnosticsForLine(filePath, line) {
|
|
95
|
+
const diagnostics = this.getDiagnostics(filePath);
|
|
96
|
+
return diagnostics.filter((d) => d.range.start.line <= line && d.range.end.line >= line);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get counts by severity
|
|
100
|
+
*/
|
|
101
|
+
getCounts(filePath) {
|
|
102
|
+
const counts = {
|
|
103
|
+
error: 0,
|
|
104
|
+
warning: 0,
|
|
105
|
+
info: 0,
|
|
106
|
+
hint: 0
|
|
107
|
+
};
|
|
108
|
+
const diagnosticsToCount = filePath
|
|
109
|
+
? [this.getDiagnostics(filePath)]
|
|
110
|
+
: [...this.getAllDiagnostics().values()];
|
|
111
|
+
for (const diagnostics of diagnosticsToCount) {
|
|
112
|
+
for (const d of diagnostics) {
|
|
113
|
+
counts[d.severity]++;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return counts;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get total count
|
|
120
|
+
*/
|
|
121
|
+
getTotalCount(filePath) {
|
|
122
|
+
const counts = this.getCounts(filePath);
|
|
123
|
+
return counts.error + counts.warning + counts.info + counts.hint;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Check if position is in range
|
|
127
|
+
*/
|
|
128
|
+
positionInRange(pos, range) {
|
|
129
|
+
if (pos.line < range.start.line || pos.line > range.end.line) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
if (pos.line === range.start.line && pos.column < range.start.column) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
if (pos.line === range.end.line && pos.column > range.end.column) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Filter diagnostics by config
|
|
142
|
+
*/
|
|
143
|
+
filterDiagnostics(diagnostics) {
|
|
144
|
+
if (!this._config.enabled)
|
|
145
|
+
return [];
|
|
146
|
+
return diagnostics.filter((d) => this._config.severityFilter.includes(d.severity));
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Apply a fix
|
|
150
|
+
*/
|
|
151
|
+
applyFix(diagnostic, fix) {
|
|
152
|
+
// Return the edits for the caller to apply
|
|
153
|
+
return fix.edits;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get config
|
|
157
|
+
*/
|
|
158
|
+
get config() {
|
|
159
|
+
return { ...this._config };
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Update config
|
|
163
|
+
*/
|
|
164
|
+
setConfig(config) {
|
|
165
|
+
this._config = { ...this._config, ...config };
|
|
166
|
+
this.notify();
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Enable/disable
|
|
170
|
+
*/
|
|
171
|
+
setEnabled(enabled) {
|
|
172
|
+
this._config.enabled = enabled;
|
|
173
|
+
this.notify();
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Check if enabled
|
|
177
|
+
*/
|
|
178
|
+
isEnabled() {
|
|
179
|
+
return this._config.enabled;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Set severity filter
|
|
183
|
+
*/
|
|
184
|
+
setSeverityFilter(severities) {
|
|
185
|
+
this._config.severityFilter = severities;
|
|
186
|
+
this.notify();
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Subscribe to changes
|
|
190
|
+
*/
|
|
191
|
+
subscribe(listener) {
|
|
192
|
+
this._listeners.add(listener);
|
|
193
|
+
return () => this._listeners.delete(listener);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Notify listeners
|
|
197
|
+
*/
|
|
198
|
+
notify() {
|
|
199
|
+
for (const listener of this._listeners) {
|
|
200
|
+
listener();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Clean up
|
|
205
|
+
*/
|
|
206
|
+
destroy() {
|
|
207
|
+
this._listeners.clear();
|
|
208
|
+
this._diagnostics.clear();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Create a new DiagnosticsManager instance
|
|
213
|
+
*/
|
|
214
|
+
export function createDiagnosticsManager() {
|
|
215
|
+
return new DiagnosticsManager();
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Get severity icon
|
|
219
|
+
*/
|
|
220
|
+
export function getSeverityIcon(severity) {
|
|
221
|
+
switch (severity) {
|
|
222
|
+
case 'error':
|
|
223
|
+
return '✕';
|
|
224
|
+
case 'warning':
|
|
225
|
+
return '⚠';
|
|
226
|
+
case 'info':
|
|
227
|
+
return 'ℹ';
|
|
228
|
+
case 'hint':
|
|
229
|
+
return '💡';
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Get severity color
|
|
234
|
+
*/
|
|
235
|
+
export function getSeverityColor(severity) {
|
|
236
|
+
switch (severity) {
|
|
237
|
+
case 'error':
|
|
238
|
+
return '#f44747';
|
|
239
|
+
case 'warning':
|
|
240
|
+
return '#ff8c00';
|
|
241
|
+
case 'info':
|
|
242
|
+
return '#3794ff';
|
|
243
|
+
case 'hint':
|
|
244
|
+
return '#6c6c6c';
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get severity label
|
|
249
|
+
*/
|
|
250
|
+
export function getSeverityLabel(severity) {
|
|
251
|
+
switch (severity) {
|
|
252
|
+
case 'error':
|
|
253
|
+
return 'Error';
|
|
254
|
+
case 'warning':
|
|
255
|
+
return 'Warning';
|
|
256
|
+
case 'info':
|
|
257
|
+
return 'Info';
|
|
258
|
+
case 'hint':
|
|
259
|
+
return 'Hint';
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Sort diagnostics by severity then line
|
|
264
|
+
*/
|
|
265
|
+
export function sortDiagnostics(diagnostics) {
|
|
266
|
+
const severityOrder = {
|
|
267
|
+
error: 0,
|
|
268
|
+
warning: 1,
|
|
269
|
+
info: 2,
|
|
270
|
+
hint: 3
|
|
271
|
+
};
|
|
272
|
+
return [...diagnostics].sort((a, b) => {
|
|
273
|
+
const severityDiff = severityOrder[a.severity] - severityOrder[b.severity];
|
|
274
|
+
if (severityDiff !== 0)
|
|
275
|
+
return severityDiff;
|
|
276
|
+
return a.range.start.line - b.range.start.line;
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Generate mock diagnostics for testing
|
|
281
|
+
*/
|
|
282
|
+
export function generateMockDiagnostics(lineCount) {
|
|
283
|
+
const diagnostics = [];
|
|
284
|
+
const sources = ['typescript', 'eslint', 'prettier'];
|
|
285
|
+
const severities = ['error', 'warning', 'info', 'hint'];
|
|
286
|
+
const errorMessages = [
|
|
287
|
+
{ code: 'TS2322', message: "Type 'string' is not assignable to type 'number'" },
|
|
288
|
+
{ code: 'TS2339', message: "Property 'foo' does not exist on type 'Bar'" },
|
|
289
|
+
{ code: 'TS2304', message: "Cannot find name 'undefined_var'" },
|
|
290
|
+
{ code: 'TS7006', message: "Parameter 'x' implicitly has an 'any' type" }
|
|
291
|
+
];
|
|
292
|
+
const warningMessages = [
|
|
293
|
+
{ code: 'no-unused-vars', message: "'x' is defined but never used" },
|
|
294
|
+
{ code: 'prefer-const', message: "'let' can be replaced with 'const'" },
|
|
295
|
+
{ code: 'no-console', message: 'Unexpected console statement' }
|
|
296
|
+
];
|
|
297
|
+
// Generate ~10% of lines with diagnostics
|
|
298
|
+
const numDiagnostics = Math.floor(lineCount * 0.1);
|
|
299
|
+
for (let i = 0; i < numDiagnostics; i++) {
|
|
300
|
+
const line = Math.floor(Math.random() * lineCount);
|
|
301
|
+
const severity = severities[Math.floor(Math.random() * severities.length)];
|
|
302
|
+
const source = sources[Math.floor(Math.random() * sources.length)];
|
|
303
|
+
let messageInfo;
|
|
304
|
+
if (severity === 'error') {
|
|
305
|
+
messageInfo = errorMessages[Math.floor(Math.random() * errorMessages.length)];
|
|
306
|
+
}
|
|
307
|
+
else if (severity === 'warning') {
|
|
308
|
+
messageInfo = warningMessages[Math.floor(Math.random() * warningMessages.length)];
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
messageInfo = { code: 'info', message: 'Consider refactoring this code' };
|
|
312
|
+
}
|
|
313
|
+
diagnostics.push({
|
|
314
|
+
id: `mock-${i}`,
|
|
315
|
+
range: {
|
|
316
|
+
start: { line, column: Math.floor(Math.random() * 20) },
|
|
317
|
+
end: { line, column: Math.floor(Math.random() * 20) + 20 }
|
|
318
|
+
},
|
|
319
|
+
severity,
|
|
320
|
+
message: messageInfo.message,
|
|
321
|
+
source,
|
|
322
|
+
code: messageInfo.code,
|
|
323
|
+
fixes: severity === 'error' || severity === 'warning'
|
|
324
|
+
? [
|
|
325
|
+
{
|
|
326
|
+
title: `Fix: ${messageInfo.message.slice(0, 30)}...`,
|
|
327
|
+
isPreferred: true,
|
|
328
|
+
edits: []
|
|
329
|
+
}
|
|
330
|
+
]
|
|
331
|
+
: undefined
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
return sortDiagnostics(diagnostics);
|
|
335
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Echo Cursor Manager
|
|
3
|
+
*
|
|
4
|
+
* Implements "Echo Mode" where your cursor leaves a trail that replays
|
|
5
|
+
* keystrokes with a configurable delay. Type in one place, and edits
|
|
6
|
+
* propagate to echo locations with visible animation.
|
|
7
|
+
*/
|
|
8
|
+
import type { Position } from './state';
|
|
9
|
+
/**
|
|
10
|
+
* Keystroke event for replay
|
|
11
|
+
*/
|
|
12
|
+
export interface KeystrokeEvent {
|
|
13
|
+
/** Event ID */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Timestamp when recorded */
|
|
16
|
+
timestamp: number;
|
|
17
|
+
/** Type of keystroke */
|
|
18
|
+
type: 'insert' | 'delete' | 'move' | 'newline' | 'tab';
|
|
19
|
+
/** Data for the keystroke */
|
|
20
|
+
data: {
|
|
21
|
+
/** Text inserted (for insert type) */
|
|
22
|
+
text?: string;
|
|
23
|
+
/** Direction for delete */
|
|
24
|
+
direction?: 'forward' | 'backward';
|
|
25
|
+
/** Count for delete */
|
|
26
|
+
count?: number;
|
|
27
|
+
/** New position for move */
|
|
28
|
+
position?: Position;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Echo cursor definition
|
|
33
|
+
*/
|
|
34
|
+
export interface EchoCursor {
|
|
35
|
+
/** Unique ID */
|
|
36
|
+
id: string;
|
|
37
|
+
/** Current position */
|
|
38
|
+
position: Position;
|
|
39
|
+
/** Delay in ms before replaying keystrokes */
|
|
40
|
+
delayMs: number;
|
|
41
|
+
/** Color for visualization */
|
|
42
|
+
color: string;
|
|
43
|
+
/** Whether this echo is active */
|
|
44
|
+
active: boolean;
|
|
45
|
+
/** Current replay position in the keystroke buffer */
|
|
46
|
+
replayIndex: number;
|
|
47
|
+
/** Whether currently animating a keystroke */
|
|
48
|
+
isReplaying: boolean;
|
|
49
|
+
/** Label for display */
|
|
50
|
+
label?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Echo mode state
|
|
54
|
+
*/
|
|
55
|
+
export interface EchoModeState {
|
|
56
|
+
/** Whether echo mode is enabled */
|
|
57
|
+
enabled: boolean;
|
|
58
|
+
/** All echo cursors */
|
|
59
|
+
echoCursors: EchoCursor[];
|
|
60
|
+
/** Keystroke buffer */
|
|
61
|
+
keystrokeBuffer: KeystrokeEvent[];
|
|
62
|
+
/** Default delay for new echoes */
|
|
63
|
+
defaultDelay: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Echo cursor event types
|
|
67
|
+
*/
|
|
68
|
+
export type EchoCursorEvent = {
|
|
69
|
+
type: 'echo-added';
|
|
70
|
+
cursor: EchoCursor;
|
|
71
|
+
} | {
|
|
72
|
+
type: 'echo-removed';
|
|
73
|
+
cursorId: string;
|
|
74
|
+
} | {
|
|
75
|
+
type: 'keystroke-recorded';
|
|
76
|
+
event: KeystrokeEvent;
|
|
77
|
+
} | {
|
|
78
|
+
type: 'replay-started';
|
|
79
|
+
cursorId: string;
|
|
80
|
+
keystroke: KeystrokeEvent;
|
|
81
|
+
} | {
|
|
82
|
+
type: 'replay-completed';
|
|
83
|
+
cursorId: string;
|
|
84
|
+
keystroke: KeystrokeEvent;
|
|
85
|
+
} | {
|
|
86
|
+
type: 'mode-changed';
|
|
87
|
+
enabled: boolean;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Echo cursor configuration
|
|
91
|
+
*/
|
|
92
|
+
export interface EchoCursorConfig {
|
|
93
|
+
/** Default delay in ms (default: 150) */
|
|
94
|
+
defaultDelay: number;
|
|
95
|
+
/** Maximum echo cursors (default: 10) */
|
|
96
|
+
maxEchoCursors: number;
|
|
97
|
+
/** Maximum keystroke buffer size (default: 1000) */
|
|
98
|
+
maxKeystrokeBuffer: number;
|
|
99
|
+
/** Colors for echo cursors */
|
|
100
|
+
colors: string[];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Echo Cursor Manager
|
|
104
|
+
*/
|
|
105
|
+
export declare class EchoCursorManager {
|
|
106
|
+
private config;
|
|
107
|
+
private echoCursors;
|
|
108
|
+
private keystrokeBuffer;
|
|
109
|
+
private replayTimers;
|
|
110
|
+
private listeners;
|
|
111
|
+
private enabled;
|
|
112
|
+
private colorIndex;
|
|
113
|
+
constructor(config?: Partial<EchoCursorConfig>);
|
|
114
|
+
/**
|
|
115
|
+
* Enable echo mode
|
|
116
|
+
*/
|
|
117
|
+
enable(): void;
|
|
118
|
+
/**
|
|
119
|
+
* Disable echo mode
|
|
120
|
+
*/
|
|
121
|
+
disable(): void;
|
|
122
|
+
/**
|
|
123
|
+
* Toggle echo mode
|
|
124
|
+
*/
|
|
125
|
+
toggle(): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Check if echo mode is enabled
|
|
128
|
+
*/
|
|
129
|
+
isEnabled(): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Add an echo cursor at a position
|
|
132
|
+
*/
|
|
133
|
+
addEchoPoint(position: Position, options?: {
|
|
134
|
+
delay?: number;
|
|
135
|
+
label?: string;
|
|
136
|
+
}): EchoCursor | null;
|
|
137
|
+
/**
|
|
138
|
+
* Remove an echo cursor
|
|
139
|
+
*/
|
|
140
|
+
removeEcho(id: string): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Clear all echo cursors
|
|
143
|
+
*/
|
|
144
|
+
clearAllEchoes(): void;
|
|
145
|
+
/**
|
|
146
|
+
* Record a keystroke from the primary cursor
|
|
147
|
+
*/
|
|
148
|
+
recordKeystroke(event: Omit<KeystrokeEvent, 'id' | 'timestamp'>): KeystrokeEvent;
|
|
149
|
+
/**
|
|
150
|
+
* Record text insertion
|
|
151
|
+
*/
|
|
152
|
+
recordInsert(text: string): KeystrokeEvent;
|
|
153
|
+
/**
|
|
154
|
+
* Record text deletion
|
|
155
|
+
*/
|
|
156
|
+
recordDelete(direction: 'forward' | 'backward', count?: number): KeystrokeEvent;
|
|
157
|
+
/**
|
|
158
|
+
* Record newline insertion
|
|
159
|
+
*/
|
|
160
|
+
recordNewline(): KeystrokeEvent;
|
|
161
|
+
/**
|
|
162
|
+
* Record tab insertion
|
|
163
|
+
*/
|
|
164
|
+
recordTab(): KeystrokeEvent;
|
|
165
|
+
/**
|
|
166
|
+
* Get all echo cursors
|
|
167
|
+
*/
|
|
168
|
+
getEchoCursors(): EchoCursor[];
|
|
169
|
+
/**
|
|
170
|
+
* Get echo cursor by ID
|
|
171
|
+
*/
|
|
172
|
+
getEchoCursor(id: string): EchoCursor | undefined;
|
|
173
|
+
/**
|
|
174
|
+
* Get keystroke buffer
|
|
175
|
+
*/
|
|
176
|
+
getKeystrokeBuffer(): readonly KeystrokeEvent[];
|
|
177
|
+
/**
|
|
178
|
+
* Update echo cursor position after replay
|
|
179
|
+
*/
|
|
180
|
+
updateEchoPosition(id: string, position: Position): void;
|
|
181
|
+
/**
|
|
182
|
+
* Subscribe to echo cursor events
|
|
183
|
+
*/
|
|
184
|
+
subscribe(listener: (event: EchoCursorEvent) => void): () => void;
|
|
185
|
+
/**
|
|
186
|
+
* Schedule keystroke replay for an echo cursor
|
|
187
|
+
*/
|
|
188
|
+
private scheduleReplay;
|
|
189
|
+
/**
|
|
190
|
+
* Emit event to listeners
|
|
191
|
+
*/
|
|
192
|
+
private emit;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Create an echo cursor manager
|
|
196
|
+
*/
|
|
197
|
+
export declare function createEchoCursorManager(config?: Partial<EchoCursorConfig>): EchoCursorManager;
|
|
198
|
+
/**
|
|
199
|
+
* Get the global echo cursor manager
|
|
200
|
+
*/
|
|
201
|
+
export declare function getEchoCursorManager(): EchoCursorManager;
|