Skip to content

Commit e0f1417

Browse files
committed
Make language extensions installable again
Still might want to look into making the native language support work but for now it seems better not to break backwards compatibility since the native implementation is quite different.
1 parent 8889059 commit e0f1417

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

patches/display-language.diff

+60
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ We can remove this once upstream supports all language packs.
1414
one but is worse because it does not handle non-existent or empty files.
1515
7. Replace some caching and Node requires because code-server does not restart
1616
when changing the language unlike native Code.
17+
8. Make language extensions installable like normal rather than using the
18+
special set/clear language actions.
1719

1820
Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
1921
===================================================================
@@ -322,3 +324,61 @@ Index: code-server/lib/vscode/src/vs/workbench/services/localization/electron-sa
322324
await this.jsonEditingService.write(this.environmentService.argvResource, [{ path: ['locale'], value: locale }], true);
323325
return true;
324326
}
327+
Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
328+
===================================================================
329+
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
330+
+++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts
331+
@@ -318,9 +318,6 @@ export abstract class AbstractInstallAct
332+
if (this.extension.isBuiltin) {
333+
return;
334+
}
335+
- if (this.extensionsWorkbenchService.canSetLanguage(this.extension)) {
336+
- return;
337+
- }
338+
if (this.extension.state === ExtensionState.Uninstalled && await this.extensionsWorkbenchService.canInstall(this.extension)) {
339+
this.enabled = this.installPreReleaseVersion ? this.extension.hasPreReleaseVersion : this.extension.hasReleaseVersion;
340+
this.updateLabel();
341+
@@ -1785,17 +1782,6 @@ export class SetLanguageAction extends E
342+
update(): void {
343+
this.enabled = false;
344+
this.class = SetLanguageAction.DisabledClass;
345+
- if (!this.extension) {
346+
- return;
347+
- }
348+
- if (!this.extensionsWorkbenchService.canSetLanguage(this.extension)) {
349+
- return;
350+
- }
351+
- if (this.extension.gallery && language === getLocale(this.extension.gallery)) {
352+
- return;
353+
- }
354+
- this.enabled = true;
355+
- this.class = SetLanguageAction.EnabledClass;
356+
}
357+
358+
override async run(): Promise<any> {
359+
@@ -1812,7 +1798,6 @@ export class ClearLanguageAction extends
360+
private static readonly DisabledClass = `${ClearLanguageAction.EnabledClass} disabled`;
361+
362+
constructor(
363+
- @IExtensionsWorkbenchService private readonly extensionsWorkbenchService: IExtensionsWorkbenchService,
364+
@ILocaleService private readonly localeService: ILocaleService,
365+
) {
366+
super(ClearLanguageAction.ID, ClearLanguageAction.TITLE.value, ClearLanguageAction.DisabledClass, false);
367+
@@ -1822,17 +1807,6 @@ export class ClearLanguageAction extends
368+
update(): void {
369+
this.enabled = false;
370+
this.class = ClearLanguageAction.DisabledClass;
371+
- if (!this.extension) {
372+
- return;
373+
- }
374+
- if (!this.extensionsWorkbenchService.canSetLanguage(this.extension)) {
375+
- return;
376+
- }
377+
- if (this.extension.gallery && language !== getLocale(this.extension.gallery)) {
378+
- return;
379+
- }
380+
- this.enabled = true;
381+
- this.class = ClearLanguageAction.EnabledClass;
382+
}
383+
384+
override async run(): Promise<any> {

0 commit comments

Comments
 (0)