@codingame/monaco-vscode-language-detection-worker-service-override 9.0.3 → 10.0.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-language-detection-worker-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
32
|
+
"vscode": "npm:@codingame/monaco-vscode-api@10.0.1",
|
|
33
33
|
"@vscode/vscode-languagedetection": "1.0.21"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/vscode/src/vs/workbench/contrib/languageDetection/browser/languageDetection.contribution.js
CHANGED
|
@@ -5,8 +5,6 @@ import { localize, localize2 } from 'vscode/vscode/vs/nls';
|
|
|
5
5
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
6
6
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
7
7
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
8
|
-
import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
9
|
-
import { StatusbarAlignment } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
10
8
|
import { IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar.service';
|
|
11
9
|
import { LanguageDetectionLanguageEventSource } from 'vscode/vscode/vs/workbench/services/languageDetection/common/languageDetectionWorkerService';
|
|
12
10
|
import { ILanguageDetectionService } from 'vscode/vscode/vs/workbench/services/languageDetection/common/languageDetectionWorkerService.service';
|
|
@@ -16,9 +14,7 @@ import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/
|
|
|
16
14
|
import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
17
15
|
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
|
|
18
16
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
19
|
-
import { KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
20
17
|
import { NOTEBOOK_EDITOR_EDITABLE } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
21
|
-
import { KeyCode, KeyMod } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
22
18
|
import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
|
|
23
19
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
24
20
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
@@ -75,21 +71,21 @@ let LanguageDetectionStatusContribution = class LanguageDetectionStatusContribut
|
|
|
75
71
|
const existing = editorModel.getLanguageId();
|
|
76
72
|
if (lang && lang !== existing && skip[existing] !== lang) {
|
|
77
73
|
const detectedName = this._languageService.getLanguageName(lang) || lang;
|
|
78
|
-
let tooltip = ( localize(
|
|
74
|
+
let tooltip = ( localize(2573, "Accept Detected Language: {0}", detectedName));
|
|
79
75
|
const keybinding = this._keybindingService.lookupKeybinding(detectLanguageCommandId);
|
|
80
76
|
const label = keybinding?.getLabel();
|
|
81
77
|
if (label) {
|
|
82
78
|
tooltip += ` (${label})`;
|
|
83
79
|
}
|
|
84
80
|
const props = {
|
|
85
|
-
name: ( localize(
|
|
86
|
-
ariaLabel: ( localize(
|
|
81
|
+
name: ( localize(2574, "Language Detection")),
|
|
82
|
+
ariaLabel: ( localize(2575, "Change to Detected Language: {0}", lang)),
|
|
87
83
|
tooltip,
|
|
88
84
|
command: detectLanguageCommandId,
|
|
89
85
|
text: '$(lightbulb-autofix)',
|
|
90
86
|
};
|
|
91
87
|
if (!this._combinedEntry) {
|
|
92
|
-
this._combinedEntry = this._statusBarService.addEntry(props, LanguageDetectionStatusContribution_1._id,
|
|
88
|
+
this._combinedEntry = this._statusBarService.addEntry(props, LanguageDetectionStatusContribution_1._id, 1 , { id: 'status.editor.mode', alignment: 1 , compact: true });
|
|
93
89
|
}
|
|
94
90
|
else {
|
|
95
91
|
this._combinedEntry.update(props);
|
|
@@ -110,18 +106,18 @@ LanguageDetectionStatusContribution = LanguageDetectionStatusContribution_1 = (
|
|
|
110
106
|
( (__param(4, ILanguageService))),
|
|
111
107
|
( (__param(5, IKeybindingService)))
|
|
112
108
|
], LanguageDetectionStatusContribution)));
|
|
113
|
-
( (Registry.as(Extensions.Workbench))).registerWorkbenchContribution(LanguageDetectionStatusContribution,
|
|
109
|
+
( (Registry.as(Extensions.Workbench))).registerWorkbenchContribution(LanguageDetectionStatusContribution, 3 );
|
|
114
110
|
registerAction2(class extends Action2 {
|
|
115
111
|
constructor() {
|
|
116
112
|
super({
|
|
117
113
|
id: detectLanguageCommandId,
|
|
118
|
-
title: ( localize2(
|
|
114
|
+
title: ( localize2(2576, "Detect Language from Content")),
|
|
119
115
|
f1: true,
|
|
120
116
|
precondition: ( (ContextKeyExpr.and(
|
|
121
117
|
(NOTEBOOK_EDITOR_EDITABLE.toNegated()),
|
|
122
118
|
EditorContextKeys.editorTextFocus
|
|
123
119
|
))),
|
|
124
|
-
keybinding: { primary:
|
|
120
|
+
keybinding: { primary: 34 | 512 | 1024 , weight: 200 }
|
|
125
121
|
});
|
|
126
122
|
}
|
|
127
123
|
async run(accessor) {
|
|
@@ -136,7 +132,7 @@ registerAction2(class extends Action2 {
|
|
|
136
132
|
editor.getModel()?.setLanguage(lang, LanguageDetectionLanguageEventSource);
|
|
137
133
|
}
|
|
138
134
|
else {
|
|
139
|
-
notificationService.warn(( localize(
|
|
135
|
+
notificationService.warn(( localize(2577, "Unable to detect editor language")));
|
|
140
136
|
}
|
|
141
137
|
}
|
|
142
138
|
}
|
|
@@ -8,17 +8,14 @@ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/c
|
|
|
8
8
|
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
9
9
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
10
10
|
import 'vscode/vscode/vs/base/common/platform';
|
|
11
|
-
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
12
11
|
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
13
12
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
14
13
|
import { IDiagnosticsService } from 'vscode/vscode/vs/platform/diagnostics/common/diagnostics.service';
|
|
15
14
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
16
15
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
17
|
-
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
18
16
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
19
17
|
import { LRUCache } from 'vscode/vscode/vs/base/common/map';
|
|
20
18
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
21
|
-
import 'vscode/vscode/vs/base/common/amd';
|
|
22
19
|
import { createWebWorker } from 'vscode/vscode/vs/base/browser/defaultWorkerFactory';
|
|
23
20
|
import { WorkerTextModelSyncClient } from 'vscode/vscode/vs/editor/common/services/textModelSync/textModelSync.impl';
|
|
24
21
|
import { LanguageDetectionWorkerHost } from './languageDetectionWorker.protocol.js';
|
|
@@ -111,14 +108,14 @@ let LanguageDetectionService = class LanguageDetectionService extends Disposable
|
|
|
111
108
|
}
|
|
112
109
|
initEditorOpenedListeners(storageService) {
|
|
113
110
|
try {
|
|
114
|
-
const globalLangHistoryData = JSON.parse(storageService.get(LanguageDetectionService_1.globalOpenedLanguagesStorageKey,
|
|
111
|
+
const globalLangHistoryData = JSON.parse(storageService.get(LanguageDetectionService_1.globalOpenedLanguagesStorageKey, 0 , '[]'));
|
|
115
112
|
this.historicalGlobalOpenedLanguageIds.fromJSON(globalLangHistoryData);
|
|
116
113
|
}
|
|
117
114
|
catch (e) {
|
|
118
115
|
console.error(e);
|
|
119
116
|
}
|
|
120
117
|
try {
|
|
121
|
-
const workspaceLangHistoryData = JSON.parse(storageService.get(LanguageDetectionService_1.workspaceOpenedLanguagesStorageKey,
|
|
118
|
+
const workspaceLangHistoryData = JSON.parse(storageService.get(LanguageDetectionService_1.workspaceOpenedLanguagesStorageKey, 1 , '[]'));
|
|
122
119
|
this.historicalWorkspaceOpenedLanguageIds.fromJSON(workspaceLangHistoryData);
|
|
123
120
|
}
|
|
124
121
|
catch (e) {
|
|
@@ -130,8 +127,8 @@ let LanguageDetectionService = class LanguageDetectionService extends Disposable
|
|
|
130
127
|
this.sessionOpenedLanguageIds.add(activeLanguage);
|
|
131
128
|
this.historicalGlobalOpenedLanguageIds.set(activeLanguage, true);
|
|
132
129
|
this.historicalWorkspaceOpenedLanguageIds.set(activeLanguage, true);
|
|
133
|
-
storageService.store(LanguageDetectionService_1.globalOpenedLanguagesStorageKey, JSON.stringify(this.historicalGlobalOpenedLanguageIds.toJSON()),
|
|
134
|
-
storageService.store(LanguageDetectionService_1.workspaceOpenedLanguagesStorageKey, JSON.stringify(this.historicalWorkspaceOpenedLanguageIds.toJSON()),
|
|
130
|
+
storageService.store(LanguageDetectionService_1.globalOpenedLanguagesStorageKey, JSON.stringify(this.historicalGlobalOpenedLanguageIds.toJSON()), 0 , 1 );
|
|
131
|
+
storageService.store(LanguageDetectionService_1.workspaceOpenedLanguagesStorageKey, JSON.stringify(this.historicalWorkspaceOpenedLanguageIds.toJSON()), 1 , 1 );
|
|
135
132
|
this.dirtyBiases = true;
|
|
136
133
|
}
|
|
137
134
|
}));
|