Skip to content

Commit

Permalink
Add option gating xaml intellisense
Browse files Browse the repository at this point in the history
  • Loading branch information
dibarbet committed Apr 12, 2024
1 parent 3393e96 commit ce4e82a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1682,6 +1682,12 @@
"default": null,
"description": "%configuration.dotnet.server.crashDumpPath%"
},
"dotnet.server.enableXamlIntellisense": {
"scope": "machine-overridable",
"type": "boolean",
"default": false,
"description": "%configuration.dotnet.server.enableXamlIntellisense%"
},
"dotnet.projects.binaryLogPath": {
"scope": "machine-overridable",
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"configuration.dotnet.server.trace": "Sets the logging level for the language server",
"configuration.dotnet.server.extensionPaths": "Override for path to language server --extension arguments",
"configuration.dotnet.server.crashDumpPath": "Sets a folder path where crash dumps are written to if the language server crashes. Must be writeable by the user.",
"configuration.dotnet.server.enableXamlIntellisense": "[Experimental] Enables Intellisense for XAML files",
"configuration.dotnet.projects.enableAutomaticRestore": "Enables automatic NuGet restore if the extension detects assets are missing.",
"configuration.dotnet.preferCSharpExtension": "Forces projects to load with the C# extension only. This can be useful when using legacy project types that are not supported by C# Dev Kit. (Requires window reload)",
"configuration.dotnet.implementType.insertionBehavior": "The insertion location of properties, events, and methods When implement interface or abstract class.",
Expand Down
10 changes: 6 additions & 4 deletions src/lsptoolshost/roslynLanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -819,10 +819,12 @@ export class RoslynLanguageServer {

args.push('--sessionId', getSessionId());

// Also include the Xaml Dev Kit extensions
getComponentPaths('xamlDesignTools', languageServerOptions).forEach((path) =>
additionalExtensionPaths.push(path)
);
// Also include the Xaml Dev Kit extensions, if enabled.
if (languageServerOptions.enableXamlIntellisense) {
getComponentPaths('xamlDesignTools', languageServerOptions).forEach((path) =>
additionalExtensionPaths.push(path)
);
}
return args;
}

Expand Down
6 changes: 6 additions & 0 deletions src/shared/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export interface LanguageServerOptions {
readonly analyzerDiagnosticScope: string;
readonly compilerDiagnosticScope: string;
readonly componentPaths: { [key: string]: string } | null;
readonly enableXamlIntellisense: boolean;
}

export interface RazorOptions {
Expand Down Expand Up @@ -401,6 +402,9 @@ class LanguageServerOptionsImpl implements LanguageServerOptions {
public get componentPaths() {
return readOption<{ [key: string]: string }>('dotnet.server.componentPaths', {});
}
public get enableXamlIntellisense() {
return readOption<boolean>('dotnet.server.enableXamlIntellisense', false);
}
}

class RazorOptionsImpl implements RazorOptions {
Expand Down Expand Up @@ -494,4 +498,6 @@ export const LanguageServerOptionsThatTriggerReload: ReadonlyArray<keyof Languag
'logLevel',
'documentSelector',
'preferCSharpExtension',
'componentPaths',
'enableXamlIntellisense',
];

0 comments on commit ce4e82a

Please sign in to comment.