Merge branch 'main' into aiday/telemetryDiagnosticData

This commit is contained in:
Alexandru Dima
2023-08-24 12:00:25 +02:00
committed by GitHub
288 changed files with 5408 additions and 1735 deletions
@@ -24,7 +24,7 @@
},
{
"type": "string",
"pattern": "^([a-z0-9-]+):(\\d{1,5})$"
"pattern": "^([a-z0-9_-]+):(\\d{1,5})$"
}
]
}
+5 -4
View File
@@ -14,7 +14,8 @@ The Git extension exposes an API, reachable by any other extension.
2. Include `git-base.d.ts` in your extension's compilation.
3. Get a hold of the API with the following snippet:
```ts
const gitBaseExtension = vscode.extensions.getExtension<GitBaseExtension>('vscode.git-base').exports;
const git = gitBaseExtension.getAPI(1);
```
```ts
const gitBaseExtension = vscode.extensions.getExtension<GitBaseExtension>('vscode.git-base').exports;
const git = gitBaseExtension.getAPI(1);
```
+4 -4
View File
@@ -14,7 +14,7 @@ The Git extension exposes an API, reachable by any other extension.
2. Include `git.d.ts` in your extension's compilation.
3. Get a hold of the API with the following snippet:
```ts
const gitExtension = vscode.extensions.getExtension<GitExtension>('vscode.git').exports;
const git = gitExtension.getAPI(1);
```
```ts
const gitExtension = vscode.extensions.getExtension<GitExtension>('vscode.git').exports;
const git = gitExtension.getAPI(1);
```
+3 -3
View File
@@ -1,6 +1,6 @@
{
"editor.insertSpaces": false,
"prettier.semi": true,
"prettier.singleQuote": true,
"prettier.printWidth": 120,
}
"prettier.singleQuote": true,
"prettier.printWidth": 120
}
+2
View File
@@ -1,10 +1,12 @@
The file `JavaScript.tmLanguage.json` is derived from [TypeScriptReact.tmLanguage](https://github.com/microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage).
To update to the latest version:
- `cd extensions/typescript` and run `npm run update-grammars`
- don't forget to run the integration tests at `./scripts/test-integration.sh`
The script does the following changes:
- fileTypes .tsx -> .js & .jsx
- scopeName scope.tsx -> scope.js
- update all rule names .tsx -> .js
+1 -1
View File
@@ -4,4 +4,4 @@
## Features
See [JSON in Visual Studio Code](https://code.visualstudio.com/docs/languages/json) to learn about the features of this extension.
See [JSON in Visual Studio Code](https://code.visualstudio.com/docs/languages/json) to learn about the features of this extension.
@@ -11,6 +11,7 @@ The JSON Language server provides language-specific smarts for editing, validati
### Server capabilities
The JSON language server supports requests on documents of language id `json` and `jsonc`.
- `json` documents are parsed and validated following the [JSON specification](https://tools.ietf.org/html/rfc7159).
- `jsonc` documents additionally accept single line (`//`) and multi-line comments (`/* ... */`). JSONC is a VSCode specific file format, intended for VSCode configuration files, without any aspirations to define a new common file format.
@@ -25,12 +26,12 @@ The server implements the following capabilities of the language server protocol
- Semantic Selection for semantic selection for one or multiple cursor positions.
- [Goto Definition](https://microsoft.github.io/language-server-protocol/specification#textDocument_definition) for $ref references in JSON schemas
- [Diagnostics (Validation)](https://microsoft.github.io/language-server-protocol/specification#textDocument_publishDiagnostics) are pushed for all open documents
- syntax errors
- structural validation based on the document's [JSON schema](http://json-schema.org/).
- syntax errors
- structural validation based on the document's [JSON schema](http://json-schema.org/).
In order to load JSON schemas, the JSON server uses NodeJS `http` and `fs` modules. For all other features, the JSON server only relies on the documents and settings provided by the client through the LSP.
### Client requirements:
### Client requirements
The JSON language server expects the client to only send requests and notifications for documents of language id `json` and `jsonc`.
@@ -56,8 +57,8 @@ Clients may send a `workspace/didChangeConfiguration` notification to notify the
The server supports the following settings:
- http
- `proxy`: The URL of the proxy server to use when fetching schema. When undefined or empty, no proxy is used.
- `proxyStrictSSL`: Whether the proxy server certificate should be verified against the list of supplied CAs.
- `proxy`: The URL of the proxy server to use when fetching schema. When undefined or empty, no proxy is used.
- `proxyStrictSSL`: Whether the proxy server certificate should be verified against the list of supplied CAs.
- json
- `format`
@@ -72,6 +73,7 @@ The server supports the following settings:
- `resultLimit`: The max number of color decorators and outline symbols to be computed (for performance reasons)
- `jsonFoldingLimit`: The max number of folding ranges to be computed for json documents (for performance reasons)
- `jsoncFoldingLimit`: The max number of folding ranges to be computed for jsonc documents (for performance reasons)
```json
{
"http": {
@@ -103,6 +105,7 @@ The server supports the following settings:
[JSON schemas](http://json-schema.org/) are essential for code assist, hovers, color decorators to work and are required for structural validation.
To find the schema for a given JSON document, the server uses the following mechanisms:
- JSON documents can define the schema URL using a `$schema` property
- The settings define a schema association based on the documents URL. Settings can either associate a schema URL to a file or path pattern, and they can directly provide a schema.
- Additionally, schema associations can also be provided by a custom 'schemaAssociations' configuration call.
@@ -115,9 +118,9 @@ The `initializationOptions.handledSchemaProtocols` initialization option defines
```ts
let clientOptions: LanguageClientOptions = {
initializationOptions: {
handledSchemaProtocols: ['file'] // language server should only try to load file URLs
}
initializationOptions: {
handledSchemaProtocols: ['file'] // language server should only try to load file URLs
}
...
}
```
@@ -132,6 +135,7 @@ If `handledSchemaProtocols` is not set, the JSON language server will load the f
Requests for schemas with URLs not handled by the server are forwarded to the client through an LSP request. This request is a JSON language server-specific, non-standardized, extension to the LSP.
Request:
- method: 'vscode/content'
- params: `string` - The schema URL to request.
- response: `string` - The content of the schema with the given URL
@@ -146,6 +150,7 @@ The server will, as a response, clear the schema content from the cache and relo
In addition to the settings, schemas associations can also be provided through a notification from the client to the server. This notification is a JSON language server-specific, non-standardized, extension to the LSP.
Notification:
- method: 'json/schemaAssociations'
- params: `ISchemaAssociations` or `ISchemaAssociation[]` defined as follows
@@ -183,11 +188,14 @@ interface ISchemaAssociation {
}
```
`ISchemaAssociations`
- keys: a file names or file path (separated by `/`). `*` can be used as a wildcard.
- values: An array of schema URLs
- keys: a file names or file path (separated by `/`). `*` can be used as a wildcard.
- values: An array of schema URLs
Notification:
- method: 'json/schemaContent'
- params: `string` the URL of the schema that has changed.
@@ -226,6 +234,7 @@ The source code of the JSON language server can be found in the [VSCode reposito
File issues and pull requests in the [VSCode GitHub Issues](https://github.com/microsoft/vscode/issues). See the document [How to Contribute](https://github.com/microsoft/vscode/wiki/How-to-Contribute) on how to build and run from source.
Most of the functionality of the server is located in libraries:
- [jsonc-parser](https://github.com/microsoft/node-jsonc-parser) contains the JSON parser and scanner.
- [vscode-json-languageservice](https://github.com/microsoft/vscode-json-languageservice) contains the implementation of all features as a re-usable library.
- [vscode-languageserver-node](https://github.com/microsoft/vscode-languageserver-node) contains the implementation of language server for NodeJS.
@@ -4,4 +4,4 @@
## Features
See [Markdown in Visual Studio Code](https://code.visualstudio.com/docs/languages/markdown) to learn about the features of this extension.
See [Markdown in Visual Studio Code](https://code.visualstudio.com/docs/languages/markdown) to learn about the features of this extension.
@@ -106,10 +106,10 @@ sup {
line-height: 0;
}
ul ul,
ul ol,
ol ul,
ol ol {
ul ul:first-child,
ul ol:first-child,
ol ul:first-child,
ol ol:first-child {
margin-bottom: 0;
}
@@ -138,6 +138,10 @@ p {
margin-bottom: 16px;
}
li p {
margin-bottom: 0.7em;
}
ul,
ol {
margin-bottom: 0.7em;
@@ -123,7 +123,8 @@
"commands": [
{
"command": "_markdown.copyImage",
"title": "%markdown.copyImage.title%"
"title": "%markdown.copyImage.title%",
"category": "Markdown"
},
{
"command": "markdown.showPreview",
@@ -244,6 +245,10 @@
}
],
"commandPalette": [
{
"command": "_markdown.copyImage",
"when": "false"
},
{
"command": "markdown.showPreview",
"when": "editorLangId == markdown && !notebookEditorFocused",
@@ -6,7 +6,6 @@ The Markdown language server powers VS Code's built-in markdown support, providi
This server uses the [Markdown Language Service](https://github.com/microsoft/vscode-markdown-languageservice) to implement almost all of the language features. You can use that library if you need a library for working with Markdown instead of a full language server.
## Server capabilities
- [Completions](https://microsoft.github.io/language-server-protocol/specification#textDocument_completion) for Markdown links.
@@ -31,14 +30,13 @@ This server uses the [Markdown Language Service](https://github.com/microsoft/vs
- [Code Actions](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeAction)
- Organize link definitions source action.
- Extract link to definition refactoring.
- Organize link definitions source action.
- Extract link to definition refactoring.
- Updating links when a file is moved / renamed. Uses a custom `markdown/getEditForFileRenames` message.
- [Pull diagnostics (validation)](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics) for links.
## Client requirements
### Initialization options
@@ -53,27 +51,27 @@ Clients may send a `workspace/didChangeConfiguration` notification to notify the
The server supports the following settings:
- `markdown`
- `suggest`
- `paths`
- `enabled` — Enable/disable path suggestions.
- `suggest`
- `paths`
- `enabled` — Enable/disable path suggestions.
- `occurrencesHighlight`
- `enabled` — Enable/disable highlighting of link occurrences.
- `occurrencesHighlight`
- `enabled` — Enable/disable highlighting of link occurrences.
- `validate`
- `enabled` — Enable/disable all validation.
- `referenceLinks`
- `enabled` — Enable/disable validation of reference links: `[text][ref]`
- `fragmentLinks`
- `enabled` — Enable/disable validation of links to fragments in the current files: `[text](#head)`
- `fileLinks`
- `enabled` — Enable/disable validation of links to file in the workspace.
- `markdownFragmentLinks` — Enable/disable validation of links to headers in other Markdown files. Use `inherit` to inherit the `fragmentLinks` setting.
- `ignoredLinks` — Array of glob patterns for files that should not be validated.
- `unusedLinkDefinitions`
- `enabled` — Enable/disable validation of unused link definitions.
- `duplicateLinkDefinitions`
- `enabled` — Enable/disable validation of duplicated link definitions.
- `validate`
- `enabled` — Enable/disable all validation.
- `referenceLinks`
- `enabled` — Enable/disable validation of reference links: `[text][ref]`
- `fragmentLinks`
- `enabled` — Enable/disable validation of links to fragments in the current files: `[text](#head)`
- `fileLinks`
- `enabled` — Enable/disable validation of links to file in the workspace.
- `markdownFragmentLinks` — Enable/disable validation of links to headers in other Markdown files. Use `inherit` to inherit the `fragmentLinks` setting.
- `ignoredLinks` — Array of glob patterns for files that should not be validated.
- `unusedLinkDefinitions`
- `enabled` — Enable/disable validation of unused link definitions.
- `duplicateLinkDefinitions`
- `enabled` — Enable/disable validation of duplicated link definitions.
### Custom requests
@@ -109,7 +107,6 @@ Delete a previously created file watcher.
Get a list of all markdown files in the workspace.
## Contribute
The source code of the Markdown language server can be found in the [VSCode repository](https://github.com/microsoft/vscode) at [extensions/markdown-language-features/server](https://github.com/microsoft/vscode/tree/master/extensions/markdown-language-features/server).
@@ -132,4 +129,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the [MIT](https://github.com/microsoft/vscode/blob/master/LICENSE.txt) License.
-1
View File
@@ -16,7 +16,6 @@ This extension provides basic preview for images, audio and video files.
- `.webp`
- `.avif`
### Supported audio formats
- `.mp3`
+1 -3
View File
@@ -28,7 +28,7 @@ The extension supports running a script as a task from a folder in the Explorer.
### Others
The extension fetches data from https://registry.npmjs.org and https://registry.bower.io to provide auto-completion and information on hover features on npm dependencies.
The extension fetches data from <https://registry.npmjs.org> and <https://registry.bower.io> to provide auto-completion and information on hover features on npm dependencies.
## Settings
@@ -40,5 +40,3 @@ The extension fetches data from https://registry.npmjs.org and https://registry.
- `npm.scriptExplorerAction` - The default click action: `open` or `run`, the default is `open`.
- `npm.enableRunFromFolder` - Enable running npm scripts from the context menu of folders in Explorer, the default is `false`.
- `npm.scriptCodeLens.enable` - Enable/disable the code lenses to run a script, the default is `false`.
+1 -1
View File
@@ -4,7 +4,7 @@
"license": "MIT",
"description": "Dependencies shared by all extensions",
"dependencies": {
"typescript": "^5.2.0-dev.20230807"
"typescript": "^5.2.1-rc"
},
"scripts": {
"postinstall": "node ./postinstall.mjs"
+1 -1
View File
@@ -4,4 +4,4 @@
## Features
See [PHP in Visual Studio Code](https://code.visualstudio.com/docs/languages/php) to learn about the features of this extension.
See [PHP in Visual Studio Code](https://code.visualstudio.com/docs/languages/php) to learn about the features of this extension.
+1 -2
View File
@@ -2,5 +2,4 @@
**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
Provides a very basic browser preview using an iframe embedded in a [webview](). This extension is primarily meant to be used by other extensions for showing simple web content.
Provides a very basic browser preview using an iframe embedded in a [webviewW](). This extension is primarily meant to be used by other extensions for showing simple web content.
@@ -34,6 +34,7 @@
"meta.embedded",
"source.groovy.embedded",
"string meta.image.inline.markdown",
"variable.legacy.builtin.python"
],
"settings": {
"foreground": "#D4D4D4"
@@ -19,7 +19,8 @@
"scope": [
"meta.embedded",
"source.groovy.embedded",
"string meta.image.inline.markdown"
"string meta.image.inline.markdown",
"variable.legacy.builtin.python"
],
"settings": {
"foreground": "#FFFFFF"
@@ -3,7 +3,11 @@
"name": "Light High Contrast",
"tokenColors": [
{
"scope": ["meta.embedded", "source.groovy.embedded"],
"scope": [
"meta.embedded",
"source.groovy.embedded",
"variable.legacy.builtin.python"
],
"settings": {
"foreground": "#292929"
}
@@ -38,7 +38,8 @@
"scope": [
"meta.embedded",
"source.groovy.embedded",
"string meta.image.inline.markdown"
"string meta.image.inline.markdown",
"variable.legacy.builtin.python"
],
"settings": {
"foreground": "#000000ff"
@@ -64,7 +64,8 @@
"scope": [
"meta.embedded",
"source.groovy.embedded",
"string meta.image.inline.markdown"
"string meta.image.inline.markdown",
"variable.legacy.builtin.python"
],
"settings": {
"foreground": "#d3af86"
@@ -71,7 +71,8 @@
{
"scope": [
"meta.embedded",
"source.groovy.embedded"
"source.groovy.embedded",
"variable.legacy.builtin.python"
],
"settings": {
"foreground": "#C5C8C6"
@@ -111,7 +111,8 @@
"scope": [
"meta.embedded",
"source.groovy.embedded",
"string meta.image.inline.markdown"
"string meta.image.inline.markdown",
"variable.legacy.builtin.python"
],
"settings": {
"foreground": "#F8F8F2"
@@ -10,7 +10,8 @@
"scope": [
"meta.embedded",
"source.groovy.embedded",
"string meta.image.inline.markdown"
"string meta.image.inline.markdown",
"variable.legacy.builtin.python"
],
"settings": {
"foreground": "#333333"
@@ -70,7 +70,8 @@
"scope": [
"meta.embedded",
"source.groovy.embedded",
"string meta.image.inline.markdown"
"string meta.image.inline.markdown",
"variable.legacy.builtin.python"
],
"settings": {
"foreground": "#F8F8F8"
@@ -10,7 +10,8 @@
"scope": [
"meta.embedded",
"source.groovy.embedded",
"string meta.image.inline.markdown"
"string meta.image.inline.markdown",
"variable.legacy.builtin.python"
],
"settings": {
"foreground": "#839496"
@@ -10,7 +10,8 @@
"scope": [
"meta.embedded",
"source.groovy.embedded",
"string meta.image.inline.markdown"
"string meta.image.inline.markdown",
"variable.legacy.builtin.python"
],
"settings": {
"foreground": "#657B83"
@@ -70,7 +70,8 @@
"meta.embedded",
"source.groovy.embedded",
"meta.jsx.children",
"string meta.image.inline.markdown"
"string meta.image.inline.markdown",
"variable.legacy.builtin.python"
],
"settings": {
//"background": "#002451",
@@ -1,6 +1,7 @@
The file `TypeScript.tmLanguage.json` and `TypeScriptReact.tmLanguage.json` are derived from [TypeScript.tmLanguage](https://github.com/microsoft/TypeScript-TmLanguage/blob/master/TypeScript.tmLanguage) and [TypeScriptReact.tmLanguage](https://github.com/microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage).
To update to the latest version:
- `cd extensions/typescript` and run `npm run update-grammars`
- don't forget to run the integration tests at `./scripts/test-integration.sh`
@@ -6,6 +6,7 @@
import * as vscode from 'vscode';
import { DocumentSelector } from '../configuration/documentSelector';
import { LanguageDescription } from '../configuration/languageDescription';
import { TelemetryReporter } from '../logging/telemetry';
import { API } from '../tsServer/api';
import type * as Proto from '../tsServer/protocol/protocol';
import { Location, Position } from '../typeConverters';
@@ -29,13 +30,16 @@ class TypeScriptInlayHintsProvider extends Disposable implements vscode.InlayHin
public static readonly minVersion = API.v440;
private readonly _onDidChangeInlayHints = new vscode.EventEmitter<void>();
private readonly _onDidChangeInlayHints = this._register(new vscode.EventEmitter<void>());
public readonly onDidChangeInlayHints = this._onDidChangeInlayHints.event;
private hasReportedTelemetry = false;
constructor(
private readonly language: LanguageDescription,
private readonly client: ITypeScriptServiceClient,
private readonly fileConfigurationManager: FileConfigurationManager
private readonly fileConfigurationManager: FileConfigurationManager,
private readonly telemetryReporter: TelemetryReporter,
) {
super();
@@ -54,31 +58,47 @@ class TypeScriptInlayHintsProvider extends Disposable implements vscode.InlayHin
}));
}
async provideInlayHints(model: vscode.TextDocument, range: vscode.Range, token: vscode.CancellationToken): Promise<vscode.InlayHint[]> {
async provideInlayHints(model: vscode.TextDocument, range: vscode.Range, token: vscode.CancellationToken): Promise<vscode.InlayHint[] | undefined> {
const filepath = this.client.toOpenTsFilePath(model);
if (!filepath) {
return [];
return;
}
if (!areInlayHintsEnabledForFile(this.language, model)) {
return [];
return;
}
const start = model.offsetAt(range.start);
const length = model.offsetAt(range.end) - start;
await this.fileConfigurationManager.ensureConfigurationForDocument(model, token);
if (token.isCancellationRequested) {
return;
}
if (!this.hasReportedTelemetry) {
this.hasReportedTelemetry = true;
/* __GDPR__
"inlayHints.provide" : {
"owner": "mjbvz",
"${include}": [
"${TypeScriptCommonProperties}"
]
}
*/
this.telemetryReporter.logTelemetry('inlayHints.provide', {});
}
const response = await this.client.execute('provideInlayHints', { file: filepath, start, length }, token);
if (response.type !== 'response' || !response.success || !response.body) {
return [];
return;
}
return response.body.map(hint => {
const result = new vscode.InlayHint(
Position.fromLocation(hint.position),
this.convertInlayHintText(model.uri, hint),
hint.kind && fromProtocolInlayHintKind(hint.kind)
this.convertInlayHintText(hint),
fromProtocolInlayHintKind(hint.kind)
);
result.paddingLeft = hint.whitespaceBefore;
result.paddingRight = hint.whitespaceAfter;
@@ -86,19 +106,18 @@ class TypeScriptInlayHintsProvider extends Disposable implements vscode.InlayHin
});
}
private convertInlayHintText(resource: vscode.Uri, tsHint: Proto.InlayHintItem): string | vscode.InlayHintLabelPart[] {
private convertInlayHintText(tsHint: Proto.InlayHintItem): string | vscode.InlayHintLabelPart[] {
if (tsHint.displayParts) {
return tsHint.displayParts.map((part): vscode.InlayHintLabelPart => {
const out = new vscode.InlayHintLabelPart(part.text);
if (part.span) {
out.location = Location.fromTextSpan(resource, part.span);
out.location = Location.fromTextSpan(this.client.toResource(part.span.file), part.span);
}
return out;
});
}
return tsHint.text;
}
}
@@ -128,13 +147,14 @@ export function register(
selector: DocumentSelector,
language: LanguageDescription,
client: ITypeScriptServiceClient,
fileConfigurationManager: FileConfigurationManager
fileConfigurationManager: FileConfigurationManager,
telemetryReporter: TelemetryReporter,
) {
return conditionalRegistration([
requireMinVersion(client, TypeScriptInlayHintsProvider.minVersion),
requireSomeCapability(client, ClientCapability.Semantic),
], () => {
const provider = new TypeScriptInlayHintsProvider(language, client, fileConfigurationManager);
const provider = new TypeScriptInlayHintsProvider(language, client, fileConfigurationManager, telemetryReporter);
return vscode.languages.registerInlayHintsProvider(selector.semantic, provider);
});
}
@@ -74,7 +74,7 @@ export default class LanguageProvider extends Disposable {
import('./languageFeatures/formatting').then(provider => this._register(provider.register(selector, this.description, this.client, this.fileConfigurationManager))),
import('./languageFeatures/hover').then(provider => this._register(provider.register(selector, this.client, this.fileConfigurationManager))),
import('./languageFeatures/implementations').then(provider => this._register(provider.register(selector, this.client))),
import('./languageFeatures/inlayHints').then(provider => this._register(provider.register(selector, this.description, this.client, this.fileConfigurationManager))),
import('./languageFeatures/inlayHints').then(provider => this._register(provider.register(selector, this.description, this.client, this.fileConfigurationManager, this.telemetryReporter))),
import('./languageFeatures/jsDocCompletions').then(provider => this._register(provider.register(selector, this.description, this.client, this.fileConfigurationManager))),
import('./languageFeatures/linkedEditing').then(provider => this._register(provider.register(selector, this.client))),
import('./languageFeatures/organizeImports').then(provider => this._register(provider.register(selector, this.client, this.commandManager, this.fileConfigurationManager, this.telemetryReporter))),
@@ -1,4 +1,5 @@
# vscode-wasm-typescript
Language server host for typescript using vscode's sync-api in the browser
## TODOs
@@ -22,33 +23,33 @@ Language server host for typescript using vscode's sync-api in the browser
- LATER: Turns out you can skip the existing server by depending on tsserverlibrary instead of tsserver.
- [x] figure out a webpack-native way to generate tsserver.web.js if possible
- [x] path rewriting is pretty loosey-goosey; likely to be incorrect some of the time
- invert the logic from TypeScriptServiceClient.normalizedPath for requests
- invert the function from webServer.ts for responses (maybe)
- something with getWorkspaceRootForResource (or anything else that checks `resouce.scheme`)
- invert the logic from TypeScriptServiceClient.normalizedPath for requests
- invert the function from webServer.ts for responses (maybe)
- something with getWorkspaceRootForResource (or anything else that checks `resouce.scheme`)
- [x] put files one level down from virtual root
- [x] fill in missing environment files like lib.dom.d.ts
- toResource's isWeb branch *probably* knows where to find this, just need to put it in the virtual FS
- I guess during setup in serverProcess.browser.ts.
- Not sure whether it needs to have the data or just a fs entry.
- Wait, I don't know how files get added to the FS normally.
- toResource's isWeb branch *probably* knows where to find this, just need to put it in the virtual FS
- I guess during setup in serverProcess.browser.ts.
- Not sure whether it needs to have the data or just a fs entry.
- Wait, I don't know how files get added to the FS normally.
- [x] cancellation should only retain one cancellation checker
- the one that matches the current request id
- but that means tracking (or retrieving from tsserver) the request id (aka seq?)
- and correctly setting/resetting it on the cancellation token too.
- I looked at the tsserver code. I think the web case is close to the single-pipe node case,
- the one that matches the current request id
- but that means tracking (or retrieving from tsserver) the request id (aka seq?)
- and correctly setting/resetting it on the cancellation token too.
- I looked at the tsserver code. I think the web case is close to the single-pipe node case,
so I just require that requestId is set in order to call the *current* cancellation checker.
- Any incoming message with a cancellation checker will overwrite the current one.
- Any incoming message with a cancellation checker will overwrite the current one.
- [x] Cancellation code in vscode is suspiciously prototypey.
- Specifically, it adds the vscode-wasm cancellation to original cancellation code, but should actually switch to the former for web only.
- looks like `isWeb()` is a way to check for being on the web
- Specifically, it adds the vscode-wasm cancellation to original cancellation code, but should actually switch to the former for web only.
- looks like `isWeb()` is a way to check for being on the web
- [x] create multiple watchers
- on-demand instead of watching everything and checking on watch firing
- on-demand instead of watching everything and checking on watch firing
- [x] get file watching to work
- it could *already* work, I just don't know how to test it
- look at extensions/markdown-language-features/src/client/fileWatchingManager.ts to see if I can use that
- later: it is OK. its main difference is that you can watch files in not-yet-created directories, and it maintains
- it could *already* work, I just don't know how to test it
- look at extensions/markdown-language-features/src/client/fileWatchingManager.ts to see if I can use that
- later: it is OK. its main difference is that you can watch files in not-yet-created directories, and it maintains
a web of directory watches that then check whether the file is eventually created.
- even later: well, it works even though it is similar to my code.
- even later: well, it works even though it is similar to my code.
I'm not sure what is different.
- [x] copy fileWatchingManager.ts to web/ ; there's no sharing code between extensions
- [x] Find out scheme the web actually uses instead of vscode-test-web (or switch over entirely to isWeb)
@@ -106,6 +107,7 @@ Language server host for typescript using vscode's sync-api in the browser
- so I can just redo whatever that did and it'll be fine
### Done
- [x] need to update 0.2 -> 0.7.* API (once it's working properly)
- [x] including reshuffling the webpack hack if needed
- [x] need to use the settings recommended by Sheetal
@@ -113,7 +115,7 @@ Language server host for typescript using vscode's sync-api in the browser
- [x] sync-api-client says fs is rooted at memfs:/sample-folder; the protocol 'memfs:' is confusing our file parsing I think
- [x] nothing ever seems to find tsconfig.json
- [x] messages aren't actually coming through, just the message from the first request
- fixed by simplifying the listener setup for now
- fixed by simplifying the listener setup for now
- [x] once messages work, you can probably log by postMessage({ type: 'log', body: "some logging text" })
- [x] implement realpath, modifiedtime, resolvepath, then turn semantic mode on
- [x] file watching implemented with saved map of filename to callback, and forwarding
@@ -125,6 +127,7 @@ Language server host for typescript using vscode's sync-api in the browser
## Notes
messages received by extension AND host use paths like ^/memfs/ts-nul-authority/sample-folder/file.ts
- problem: pretty sure the extension doesn't know what to do with that: it's not putting down error spans in file.ts
- question: why is the extension requesting quickinfo in that URI format? And it works! (probably because the result is a tooltip, not an in-file span)
- problem: weird concatenations with memfs:/ in the middle
@@ -140,15 +143,14 @@ but readFile is getting called with things like memfs:/sample-folder/memfs:/type
watchDirectory with /sample-folder/^ and directoryExists with /sample-folder/^/memfs/ts-nul-authority/sample-folder/workspaces/
watchFile with /sample-folder/memfs:/sample-folder/memfs:/lib.es2020.full.d.ts
### LATER:
### LATER
OK, so the paths that tsserver has look like this: ^/scheme/mount/whatever.ts
but the paths the filesystem has look like this: scheme:/whatever.ts (not sure about 'mount', that's only when cloning from the fs)
so you have to shave off the scheme that the host combined with the path and put on the scheme that the vfs is using.
### LATER 2:
### LATER 2
Some commands ask for getExecutingFilePath or getCurrentDirectory and cons up a path themselves.
This works, because URI.from({ scheme, path }) matches what the fs has in it
Problem: In *some* messages (all?), vscode then refers to /x.ts and ^/vscode-test-web/mount/x.ts (or ^/memfs/ts-nul-authority/x.ts)
+1 -2
View File
@@ -19,6 +19,7 @@
"fileSearchProvider",
"findTextInFiles",
"fsChunks",
"mappedEditsProvider",
"notebookCellExecutionState",
"notebookDeprecated",
"notebookLiveShare",
@@ -44,14 +45,12 @@
"textSearchProvider",
"timeline",
"tokenInformation",
"treeItemCheckbox",
"treeViewActiveItem",
"treeViewReveal",
"workspaceTrust",
"telemetry",
"windowActivity",
"interactiveUserActions",
"envCollectionWorkspace",
"envCollectionOptions"
],
"private": true,
@@ -0,0 +1,102 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as path from 'path';
import * as vscode from 'vscode';
import * as assert from 'assert';
suite('mapped edits provider', () => {
test('mapped edits does not provide edits for unregistered langs', async function () {
const uri = vscode.Uri.file(path.join(vscode.workspace.rootPath || '', './myFile.ts'));
const tsDocFilter = [{ language: 'json' }];
const r1 = vscode.chat.registerMappedEditsProvider(tsDocFilter, {
provideMappedEdits: (_doc: vscode.TextDocument, codeBlocks: string[], context: vscode.MappedEditsContext, _token: vscode.CancellationToken) => {
assert(context.selections.length === 1);
assert(context.related.length === 1);
assert('uri' in context.related[0] && 'range' in context.related[0]);
const edit = new vscode.WorkspaceEdit();
const text = codeBlocks.join('\n//----\n');
edit.replace(uri, context.selections[0], text);
return edit;
}
});
await vscode.workspace.openTextDocument(uri);
const result = await vscode.commands.executeCommand<vscode.ProviderResult<vscode.WorkspaceEdit | null>>(
'vscode.executeMappedEditsProvider',
uri,
[
'// hello',
`function foo() {\n\treturn 1;\n}`,
],
{
selections: [new vscode.Selection(0, 0, 1, 0)],
related: [
{
uri,
range: new vscode.Range(new vscode.Position(0, 0), new vscode.Position(1, 0))
}
]
}
);
r1.dispose();
assert(result === null, 'returned null');
});
test('mapped edits provides a single edit replacing the selection', async function () {
const uri = vscode.Uri.file(path.join(vscode.workspace.rootPath || '', './myFile.ts'));
const tsDocFilter = [{ language: 'typescript' }];
const r1 = vscode.chat.registerMappedEditsProvider(tsDocFilter, {
provideMappedEdits: (_doc: vscode.TextDocument, codeBlocks: string[], context: vscode.MappedEditsContext, _token: vscode.CancellationToken) => {
assert(context.selections.length === 1);
assert(context.related.length === 1);
assert('uri' in context.related[0] && 'range' in context.related[0]);
const edit = new vscode.WorkspaceEdit();
const text = codeBlocks.join('\n//----\n');
edit.replace(uri, context.selections[0], text);
return edit;
}
});
await vscode.workspace.openTextDocument(uri);
const result = await vscode.commands.executeCommand<vscode.ProviderResult<vscode.WorkspaceEdit | null>>(
'vscode.executeMappedEditsProvider',
uri,
[
'// hello',
`function foo() {\n\treturn 1;\n}`,
],
{
selections: [new vscode.Selection(0, 0, 1, 0)],
related: [
{
uri,
range: new vscode.Range(new vscode.Position(0, 0), new vscode.Position(1, 0))
}
]
}
);
r1.dispose();
assert(result, 'non null response');
const edits = result.get(uri);
assert(edits.length === 1);
assert(edits[0].range.start.line === 0);
assert(edits[0].range.start.character === 0);
assert(edits[0].range.end.line === 1);
assert(edits[0].range.end.character === 0);
});
});
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { deepStrictEqual, doesNotThrow, equal, ok, strictEqual, throws } from 'assert';
import { commands, ConfigurationTarget, Disposable, env, EnvironmentVariableCollection, EnvironmentVariableMutator, EnvironmentVariableMutatorOptions, EnvironmentVariableMutatorType, EnvironmentVariableScope, EventEmitter, ExtensionContext, extensions, ExtensionTerminalOptions, Pseudoterminal, Terminal, TerminalDimensions, TerminalExitReason, TerminalOptions, TerminalState, UIKind, Uri, window, workspace } from 'vscode';
import { commands, ConfigurationTarget, Disposable, env, EnvironmentVariableMutator, EnvironmentVariableMutatorOptions, EnvironmentVariableMutatorType, EventEmitter, ExtensionContext, extensions, ExtensionTerminalOptions, Pseudoterminal, Terminal, TerminalDimensions, TerminalExitReason, TerminalOptions, TerminalState, UIKind, Uri, window, workspace } from 'vscode';
import { assertNoRpc, poll } from '../utils';
// Disable terminal tests:
@@ -912,11 +912,10 @@ import { assertNoRpc, poll } from '../utils';
});
test('get and forEach should work (scope)', () => {
// TODO: Remove cast once `envCollectionWorkspace` API is finalized.
const collection = extensionContext.environmentVariableCollection as (EnvironmentVariableCollection & { getScopedEnvironmentVariableCollection(scope: EnvironmentVariableScope): EnvironmentVariableCollection });
const collection = extensionContext.environmentVariableCollection;
disposables.push({ dispose: () => collection.clear() });
const scope = { workspaceFolder: { uri: Uri.file('workspace1'), name: 'workspace1', index: 0 } };
const scopedCollection = collection.getScopedEnvironmentVariableCollection(scope);
const scopedCollection = collection.getScoped(scope);
scopedCollection.replace('A', 'scoped~a2~');
scopedCollection.append('B', 'scoped~b2~');
scopedCollection.prepend('C', 'scoped~c2~');
@@ -928,7 +927,7 @@ import { assertNoRpc, poll } from '../utils';
applyAtProcessCreation: true,
applyAtShellIntegration: false
};
const expectedScopedCollection = collection.getScopedEnvironmentVariableCollection(scope);
const expectedScopedCollection = collection.getScoped(scope);
deepStrictEqual(expectedScopedCollection.get('A'), { value: 'scoped~a2~', type: EnvironmentVariableMutatorType.Replace, options: defaultOptions });
deepStrictEqual(expectedScopedCollection.get('B'), { value: 'scoped~b2~', type: EnvironmentVariableMutatorType.Append, options: defaultOptions });
deepStrictEqual(expectedScopedCollection.get('C'), { value: 'scoped~c2~', type: EnvironmentVariableMutatorType.Prepend, options: defaultOptions });
@@ -0,0 +1,3 @@
// 1
// 2
// 3
@@ -103,4 +103,4 @@ Pop
* Multiple definitions and terms are possible
* Definitions can include multiple paragraphs too
*[ABBR]: Markdown plus abbreviations (produces an <abbr> tag)
*[ABBR]: Markdown plus abbreviations (produces an <abbr> tag)
@@ -1907,14 +1907,14 @@
"c": "reduce",
"t": "source.python meta.function-call.python variable.legacy.builtin.python",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE",
"dark_modern": "variable: #9CDCFE",
"hc_light": "variable: #001080",
"light_modern": "variable: #001080"
"dark_plus": "variable.legacy.builtin.python: #D4D4D4",
"light_plus": "variable.legacy.builtin.python: #000000",
"dark_vs": "variable.legacy.builtin.python: #D4D4D4",
"light_vs": "variable.legacy.builtin.python: #000000",
"hc_black": "variable.legacy.builtin.python: #FFFFFF",
"dark_modern": "variable.legacy.builtin.python: #D4D4D4",
"hc_light": "variable.legacy.builtin.python: #292929",
"light_modern": "variable.legacy.builtin.python: #000000"
}
},
{
@@ -6233,14 +6233,14 @@
"c": "raw_input",
"t": "source.python meta.function-call.python variable.legacy.builtin.python",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE",
"dark_modern": "variable: #9CDCFE",
"hc_light": "variable: #001080",
"light_modern": "variable: #001080"
"dark_plus": "variable.legacy.builtin.python: #D4D4D4",
"light_plus": "variable.legacy.builtin.python: #000000",
"dark_vs": "variable.legacy.builtin.python: #D4D4D4",
"light_vs": "variable.legacy.builtin.python: #000000",
"hc_black": "variable.legacy.builtin.python: #FFFFFF",
"dark_modern": "variable.legacy.builtin.python: #D4D4D4",
"hc_light": "variable.legacy.builtin.python: #292929",
"light_modern": "variable.legacy.builtin.python: #000000"
}
},
{
+4 -4
View File
@@ -228,10 +228,10 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"
typescript@^5.2.0-dev.20230807:
version "5.2.0-dev.20230807"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.0-dev.20230807.tgz#652fa8a3fcc46958035d9b911c815299deb9f58e"
integrity sha512-sF8sZl3r/mpAdKAxASaWaoU+mNPF3g8OrZ601HraU2l4WEwAf6nO7sq0Bzl+Y3FV7sWjy+gb6kdM1CtLjVne/g==
typescript@^5.2.1-rc:
version "5.2.1-rc"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.1-rc.tgz#9cf33ff6bc39ba9e1fa59761124f596ecf5e0c07"
integrity sha512-gsOdmedQZEWLrYhNqHuzPmcV+4wX7UujzYqszDC5mVMjcN6Nm7lN2eAtndmjWl24aGdAwJqL2ooywkxpaTx8QQ==
vscode-grammar-updater@^1.1.0:
version "1.1.0"