@@ -4,7 +4,7 @@ import * as vscode from 'vscode';
44import { workspace , ExtensionContext } from 'vscode' ;
55import { initPathManager } from './install/pathManager' ;
66import { installWithRetry } from './install/installer' ;
7- import { startLanguageClient , stopLanguageServerIfRunning } from './languageServer' ;
7+ import { registerWurstDiagnosticsCommands , startLanguageClient , stopLanguageServerIfRunning } from './languageServer' ;
88import {
99 findConflictingWurstProcesses ,
1010 forceStopWurstProcesses ,
@@ -27,6 +27,7 @@ import { registerMapPreview } from './features/mapPreview';
2727import { registerAgentsGuideOffer } from './features/agentsGuide' ;
2828import { openIssueReport } from './features/issueReporting' ;
2929import { registerCascDiagnosticsCommand } from './features/preview/cascStorage' ;
30+ import { appendDiagnostic , formatDiagnosticError } from './diagnostics' ;
3031
3132export async function activate ( context : ExtensionContext ) {
3233 console . log ( 'Wurst extension activated!' ) ;
@@ -47,6 +48,7 @@ export async function activate(context: ExtensionContext) {
4748 context . subscriptions . push ( registerMapPreview ( context ) ) ;
4849 context . subscriptions . push ( registerAgentsGuideOffer ( context ) ) ;
4950 context . subscriptions . push ( registerCascDiagnosticsCommand ( ) ) ;
51+ registerWurstDiagnosticsCommands ( context ) ;
5052
5153 registerBasicCommands ( context ) ;
5254 openObjModE2eFixture ( ) ;
@@ -89,6 +91,7 @@ function registerBasicCommands(context: ExtensionContext) {
8991 await vscode . commands . executeCommand ( 'workbench.action.reloadWindow' ) ;
9092 } catch ( e : any ) {
9193 if ( e instanceof InstallCoordinationCancelledError ) return ;
94+ appendDiagnostic ( 'VS Code extension' , `Install/update failed: ${ formatDiagnosticError ( e ) } ` ) ;
9295 vscode . window . showErrorMessage ( `Install/Update failed: ${ e ?. message || e } ` ) ;
9396 }
9497 } ) ,
@@ -126,6 +129,7 @@ function registerBasicCommands(context: ExtensionContext) {
126129 try {
127130 await createNewWurstProject ( ) ;
128131 } catch ( e : any ) {
132+ appendDiagnostic ( 'VS Code extension' , `New project creation failed: ${ formatDiagnosticError ( e ) } ` ) ;
129133 vscode . window . showErrorMessage ( `Failed to create Wurst project: ${ e ?. message ?? String ( e ) } ` ) ;
130134 }
131135 } ) ,
@@ -148,7 +152,8 @@ async function startLanguageClientWhenWorkspaceIsOpen(context: ExtensionContext)
148152 try {
149153 await startLanguageClient ( context ) ;
150154 } catch ( err ) {
151- console . error ( 'Failed to start language client:' , err ) ;
155+ appendDiagnostic ( 'VS Code extension' , `Failed to start language client: ${ formatDiagnosticError ( err ) } ` ) ;
156+ console . error ( 'Failed to start language client:' , formatDiagnosticError ( err ) ) ;
152157 vscode . window . showWarningMessage ( `Wurst language features disabled: ${ err } ` ) ;
153158 }
154159}
0 commit comments