File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -44,12 +44,20 @@ export const componentInfo: { [key: string]: ComponentInfo } = {
4444 } ,
4545} ;
4646
47- export function getComponentPaths ( componentName : string , options : LanguageServerOptions | undefined ) : string [ ] {
47+ export function getComponentPaths (
48+ componentName : string ,
49+ options : LanguageServerOptions | undefined ,
50+ isOptional = false
51+ ) : string [ ] {
4852 const component = componentInfo [ componentName ] ;
4953 const baseFolder = getComponentFolderPath ( component , options ) ;
5054 const paths = component . componentDllPaths . map ( ( dllPath ) => path . join ( baseFolder , dllPath ) ) ;
5155 for ( const dllPath of paths ) {
5256 if ( ! fs . existsSync ( dllPath ) ) {
57+ if ( isOptional ) {
58+ // Component is optional and doesn't exist - return empty array
59+ return [ ] ;
60+ }
5361 throw new Error ( `Component DLL not found: ${ dllPath } ` ) ;
5462 }
5563 }
Original file line number Diff line number Diff line change @@ -1026,7 +1026,7 @@ export class RoslynLanguageServer {
10261026
10271027 // Also include the Xaml Dev Kit extensions, if enabled.
10281028 if ( languageServerOptions . enableXamlTools ) {
1029- getComponentPaths ( 'xamlTools' , languageServerOptions ) . forEach ( ( path ) =>
1029+ getComponentPaths ( 'xamlTools' , languageServerOptions , true ) . forEach ( ( path ) =>
10301030 additionalExtensionPaths . push ( path )
10311031 ) ;
10321032 }
@@ -1096,7 +1096,7 @@ export class RoslynLanguageServer {
10961096 await exports . setupTelemetryEnvironmentAsync ( env ) ;
10971097 }
10981098
1099- getComponentPaths ( 'roslynCopilot' , languageServerOptions ) . forEach ( ( extPath ) => {
1099+ getComponentPaths ( 'roslynCopilot' , languageServerOptions , true ) . forEach ( ( extPath ) => {
11001100 additionalExtensionPaths . push ( extPath ) ;
11011101 } ) ;
11021102 }
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ export async function activate(
104104 await setupDevKitEnvironment ( dotnetInfo . env , csharpDevkitExtension , logger ) ;
105105
106106 if ( vscode . env . isTelemetryEnabled ) {
107- const razorComponentPaths = getComponentPaths ( 'razorDevKit' , undefined ) ;
107+ const razorComponentPaths = getComponentPaths ( 'razorDevKit' , undefined , true ) ;
108108 if ( razorComponentPaths . length !== 1 ) {
109109 logger . logError ( 'Failed to find Razor DevKit telemetry extension path.' , undefined ) ;
110110 } else {
You can’t perform that action at this time.
0 commit comments