Skip to content

Commit 72127b1

Browse files
authored
Merge pull request #195 from CodinGame/small-improvements
Small improvements
2 parents c93fd65 + 68db6dd commit 72127b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+5333
-1717
lines changed

README.md

Lines changed: 54 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,6 @@ There are workarounds for both:
8282
}
8383
}
8484
```
85-
- we can serialize and eval the code to prevent vite from touching it:
86-
```typescript
87-
{
88-
plugins: [{
89-
// prevent vite from trying to inject code into an extension file du to an `import()` in that file
90-
name: 'hack-prevent-transform-javascript',
91-
apply: 'serve',
92-
load (source) {
93-
if (source.includes('tsserver.web.js')) {
94-
return `eval(${JSON.stringify(fs.readFileSync(source).toString('utf-8'))})`
95-
}
96-
}
97-
}]
98-
}
99-
```
10085

10186
### If using Angular and getting `Not allowed to load local resource:` errors
10287

@@ -134,70 +119,81 @@ await initialize({
134119
})
135120
```
136121

137-
Additionally, this library exposes 23 modules that include the vscode version of some services (with some glue to make it work with monaco):
122+
Additionally, 25 packages that include the vscode version of some services (with some glue to make it work with monaco) are published:
138123

139-
- **Extensions** (included by default): `vscode/service-override/extensions`
124+
- **Extensions** (included by default): `@codingame/monaco-vscode-extensions-service-override`
140125
- Support for VSCode extensions. A worker configuration can be past to it:
141126
- Then, everything runs in one worker, where extensions run in an iframe, with all the implications (can be created by the bundler directly). The worker script is expected to be hosted on a separate domain.
142-
- **Files** (included by default): `vscode/service-override/files`
127+
- **Files** (included by default): `@codingame/monaco-vscode-file-service-override`
143128
- It adds the memory filesystem for `file://` files, but also adds the support for lazy loaded extension files. It adds separate memory user files (e.g. config, keybindings), cache files and log files.
144-
- **QuickAccess** (included by default): `vscode/service-override/quickaccess`
129+
- **QuickAccess** (included by default): `@codingame/monaco-vscode-quickaccess-service-override`
145130
- Enables the quickaccess menu in the editor (press F1 or ctrl+shift+p)
146-
- **Notifications**: `vscode/service-override/notifications`
131+
- **Notifications**: `@codingame/monaco-vscode-notifications-service-override`
147132
- This services enables vscode notifications you usually find in the bottom right corner.
148-
- **Dialogs**: `vscode/service-override/dialogs`
133+
- **Dialogs**: `@codingame/monaco-vscode-dialogs-service-override`
149134
- Enable vscode modal dialogs. It allows users to select an action to do. Those actions are exposed to the vscode API. Additionally, this service can be used by the language client to delegate questions to the user.
150-
- **Model**: `vscode/service-override/model`
135+
- **Model**: `@codingame/monaco-vscode-model-service-override`
151136
- This service creates and takes care of model references. For example:
152137
- Create model if content is unknown
153138
- Count references
154139
- Destroy models when they are no longer used
155-
- **Editor**: `vscode/service-override/editor`
140+
- **Editor**: `@codingame/monaco-vscode-editor-service-override`
156141
- Enable editor support. This is usually needed when working with the language server protocol. Without enabling the editor service, it will only be able to resolve the currently open model (only internal file links will work).
157-
- **Views**: `vscode/service-override/views`
142+
- **Views**: `@codingame/monaco-vscode-views-service-override`
158143
- Enable full views support. Is exclusive with the `editor` service. Do not use both services at the same time.
159-
- **Configuration**: `vscode/service-override/configuration`
144+
- **Configuration**: `@codingame/monaco-vscode-configuration-service-override`
160145
- Allows to change the configuration of not only the editors, but every part of vscode. The language client for instance uses it to send the requested configuration to the server. The default configuration service already allows to change the configuration. This service overrides makes it rely on a user configuration file (with json schema, overridable by language including all vscode features).
161-
- **Keybindings**: `vscode/service-override/keybindings`
146+
- **Keybindings**: `@codingame/monaco-vscode-keybindings-service-override`
162147
- Enables platform specific keybindings and make it rely on a user definded keybindings configuration (if available).
163-
- **Languages**: `vscode/service-override/languages`
148+
- **Languages**: `@codingame/monaco-vscode-languages-service-override`
164149
- Enable language support. It's like the standalone service with 2 differences:
165150
- It handle the language extension point (getting languages from vscode extensions)
166151
- It triggers the `onLanguage:${language}` event (to load vscode extension listening to those events)
167-
- **Textmate**: `vscode/service-override/textmate`
152+
- **Textmate**: `@codingame/monaco-vscode-textmate-service-override`
168153
- Allows to use textmate grammars. Depends on *themes* service. vscode extensions use textmate grammars exclusively for highlighting. Once this is enabled monarch grammars can no longer be loaded by monaco-editor.
169-
- **Themes**: `vscode/service-override/theme`
154+
- **Themes**: `@codingame/monaco-vscode-theme-service-override`
170155
- Allows to use VSCode themes.
171-
- **Snippets**: `vscode/service-override/snippets`
156+
- **Snippets**: `@codingame/monaco-vscode-snippets-service-override`
172157
- Add snippet extension point (register vscode extension snippets)
173-
- **Audio cue**: `vscode/service-override/audioCue`
158+
- **Audio cue**: `@codingame/monaco-vscode-audio-cue-service-override`
174159
- If enabled the editor may provides audible hints
175-
- **Debug**: `vscode/service-override/debug`
160+
- **Debug**: `@codingame/monaco-vscode-debug-service-override`
176161
- Activate debugging support
177-
- **Preferences**: `vscode/service-override/preferences`
162+
- **Preferences**: `@codingame/monaco-vscode-preferences-service-override`
178163
- Allow to read and write preferences
179-
- **Output**: `vscode/service-override/output`
164+
- **Output**: `@codingame/monaco-vscode-output-service-override`
180165
- Output panel support. *Hint*: It only makes sense to enable it when *Views* service is used.
181-
- **Terminal**: `vscode/service-override/terminal`
166+
- **Terminal**: `@codingame/monaco-vscode-terminal-service-override`
182167
- Terminal panel support. *Hint*: It only makes sense to enable it when *Views* service is used.
183-
- **Search**: `vscode/service-override/search`
168+
- **Search**: `@codingame/monaco-vscode-search-service-override`
184169
- search panel support. *Hint*: It only makes sense to enable it when *Views* service is used.
185-
- **Markers**: `vscode/service-override/markers`
170+
- **Markers**: `@codingame/monaco-vscode-markers-service-override`
186171
- It adds the problems panel tab. *Hint*: It only makes sense to enable it when *Views* service is used.
187-
- **Language detection worker**: `vscode/service-override/languageDetectionWorker`
172+
- **Language detection worker**: `@codingame/monaco-vscode-language-detection-worker-service-override`
188173
- When opening an untitled model or a file without extension or if vscode is unable to guess the language simply by the file extension or by reading the first line. Then it will use tensorflow in a worker to try to guess the most probable language (here we are only able to rely on the open source model).
189-
- **Storage**: `vscode/service-override/storage`
174+
- **Storage**: `@codingame/monaco-vscode-storage-service-override`
190175
- Define your own storage or use the default BrowserStorageService. The storage service is used in many places either as a cache or as a user preference store. For instance:
191176
- Current loaded theme is stored in there to be loaded faster on start.
192177
- Every panel/view positions are stored in there.
193-
178+
- **LifeCycle**: `@codingame/monaco-vscode-lifecycle-service-override`
179+
- Allow other services to veto a page reload (for instance when not all open files are saved)
180+
- **Remote agent**: `@codingame/monaco-vscode-remote-agent-service-override`
181+
- Connect to a remote vscode agent and have access to:
182+
- The remote filesystem
183+
- The remote file search
184+
- Running terminals
185+
- Running vscode extensions (not web-compatible)
186+
- and probably more?
187+
This library exports a `vscode-ext-host-server` bin to start the remote agent
188+
- **Accessibility**: `@codingame/monaco-vscode-accessibility-service-override`
189+
- Register accessibility helpers
194190
Usage:
195191

196192
```typescript
197193
import * as vscode from 'vscode'
198194
import { initialize } from 'vscode/services'
199-
import getEditorServiceOverride from 'vscode/service-override/editor'
200-
import getConfigurationServiceOverride, { updateUserConfiguration, configurationRegistry } from 'vscode/service-override/configuration'
195+
import getEditorServiceOverride from '@codingame/monaco-vscode-editor-service-override'
196+
import getConfigurationServiceOverride, { updateUserConfiguration, configurationRegistry } from '@codingame/monaco-vscode-configuration-service-override'
201197

202198
await initialize({
203199
...getModelEditorServiceOverride((model, input, sideBySide) => {
@@ -300,21 +296,21 @@ getApi().then(vscodeApi => vscodeApi.languages.registerCompletionItemProvider(..
300296

301297
VSCode uses a bunch of default extensions. Most of them are used to load the default languages and grammars (see https://github.com/microsoft/vscode/tree/main/extensions).
302298

303-
This library bundles most of them and allows to import the ones you want:
299+
This library bundles and publishes them and allows to import the ones you want:
304300
```typescript
305-
import 'vscode/default-extensions/javascript'
306-
import 'vscode/default-extensions/json'
301+
import '@codingame/monaco-vscode-javascript-default-extension'
302+
import '@codingame/monaco-vscode-json-default-extension'
307303
...
308304
```
309305

310306
### Loading vsix file
311307

312308
VSCode extension are bundled as vsix files.
313-
This library exposes a rollup plugin (vite-compatible) that allows to load a vsix file.
309+
This library publishes a rollup plugin (vite-compatible) that allows to load a vsix file.
314310

315311
- rollup/vite config:
316312
```typescript
317-
import vsixPlugin from 'vscode/rollup-vsix-plugin'
313+
import vsixPlugin from '@codingame/monaco-vscode-rollup-vsix-plugin'
318314
...
319315
plugins: [
320316
...,
@@ -357,6 +353,17 @@ For the debug feature, also run:
357353
npm run start:debugServer
358354
```
359355

356+
#### Remote agent
357+
358+
To connect to a remote agent, run:
359+
```bash
360+
npm run start:extHostServer
361+
```
362+
363+
Then go to http://localhost:5173/?remoteAuthority=localhost:8000
364+
365+
You can also go to http://localhost:5173/?remoteAuthority=localhost:8000&remotePath=/any/path/on/your/machine to open a directory on your machine as the current workspace
366+
360367
### History
361368

362369
This project was mainly created to make the implementation of [monaco-languageclient](https://github.com/TypeFox/monaco-languageclient) more robust and maintainable.

demo/.eslintrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"browser": true
5+
},
6+
"parserOptions": {
7+
"project": "./tsconfig.eslint.json"
8+
},
9+
"extends": [
10+
"@codingame"
11+
],
12+
"rules": {
13+
"import/extensions": ["off"],
14+
"@typescript-eslint/no-unused-vars": [
15+
"warn",
16+
{
17+
"argsIgnorePattern": "^_",
18+
"varsIgnorePattern": "^_",
19+
"caughtErrorsIgnorePattern": "^_"
20+
}
21+
]
22+
},
23+
"ignorePatterns": [
24+
"dist/**/*"
25+
]
26+
}

0 commit comments

Comments
 (0)