Skip to content

Commit

Permalink
Visual Studio Code - August Branch Mirror (#6)
Browse files Browse the repository at this point in the history
Thank you for submitting a Pull Request. Please:
* Read our Pull Request guidelines:

https://github.com/microsoft/vscode/wiki/How-to-Contribute#pull-requests
* Associate an issue with the Pull Request.
* Ensure that the code is up-to-date with the `main` branch.
* Include a description of the proposed changes and how to test them.
  • Loading branch information
TheHamsterBot authored Aug 31, 2024
2 parents fa1461b + 0978e9e commit 41a2040
Show file tree
Hide file tree
Showing 4,210 changed files with 82,031 additions and 66,652 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@
**/src/vs/*/**/*.d.ts
**/src/vs/base/test/common/filters.perf.data.js
**/src/vs/loader.js
**/src2/**/dompurify.js
**/src2/**/marked.js
**/src2/**/semver.js
**/src2/typings/**/*.d.ts
**/src2/vs/*/**/*.d.ts
**/src2/vs/base/test/common/filters.perf.data.js
**/src2/vs/loader.js
**/test/unit/assert.js
**/test/unit/assert-esm.js
**/test/automation/out/**
**/typings/**
!.vscode
7 changes: 6 additions & 1 deletion .eslintplugin/code-ensure-no-disposables-leak-in-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export = new class EnsureNoDisposablesAreLeakedInTestSuite implements eslint.Rul
type: 'problem',
messages: {
ensure: 'Suites should include a call to `ensureNoDisposablesAreLeakedInTestSuite()` to ensure no disposables are leaked in tests.'
}
},
fixable: 'code'
};

create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
Expand All @@ -30,6 +31,10 @@ export = new class EnsureNoDisposablesAreLeakedInTestSuite implements eslint.Rul
context.report({
node,
messageId: 'ensure',
fix: (fixer) => {
const updatedSrc = src.replace(/(suite\(.*\n)/, '$1\n\tensureNoDisposablesAreLeakedInTestSuite();\n');
return fixer.replaceText(node, updatedSrc);
}
});
}
},
Expand Down
27 changes: 24 additions & 3 deletions .eslintplugin/code-import-patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ export = new class implements eslint.Rule.RuleModule {
readonly meta: eslint.Rule.RuleMetaData = {
messages: {
badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/microsoft/vscode/wiki/Source-Code-Organization',
badFilename: 'Missing definition in `code-import-patterns` for this file. Define rules at https://github.com/microsoft/vscode/blob/main/.eslintrc.json'
badFilename: 'Missing definition in `code-import-patterns` for this file. Define rules at https://github.com/microsoft/vscode/blob/main/.eslintrc.json',
badAbsolute: 'Imports have to be relative to support ESM',
badExtension: 'Imports have to end with `.js` or `.css` to support ESM',
},
docs: {
url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization'
Expand Down Expand Up @@ -181,8 +183,8 @@ export = new class implements eslint.Rule.RuleModule {

if (targetIsVS) {
// Always add "vs/nls" and "vs/amdX"
restrictions.push('vs/nls');
restrictions.push('vs/amdX'); // TODO@jrieken remove after ESM is real
restrictions.push('vs/nls.js');
restrictions.push('vs/amdX.js'); // TODO@jrieken remove after ESM is real
}

if (targetIsVS && option.layer) {
Expand Down Expand Up @@ -212,6 +214,25 @@ export = new class implements eslint.Rule.RuleModule {
}

private _checkImport(context: eslint.Rule.RuleContext, config: ImportPatternsConfig, node: TSESTree.Node, importPath: string) {
const targetIsVS = /^src\/vs\//.test(getRelativeFilename(context));
if (targetIsVS) {

// ESM: check for import ending with ".js" or ".css"
if (importPath[0] === '.' && !importPath.endsWith('.js') && !importPath.endsWith('.css')) {
context.report({
loc: node.loc,
messageId: 'badExtension',
});
}

// check for import being relative
if (importPath.startsWith('vs/')) {
context.report({
loc: node.loc,
messageId: 'badAbsolute',
});
}
}

// resolve relative paths
if (importPath[0] === '.') {
Expand Down
22 changes: 17 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@
"http",
"https",
"minimist",
"node:module",
"native-keymap",
"native-watchdog",
"net",
Expand Down Expand Up @@ -692,6 +693,7 @@
"when": "test",
"allow": [
"vs/css.build",
"vs/css.build.js",
"assert",
"sinon",
"sinon-test"
Expand Down Expand Up @@ -937,6 +939,10 @@
"when": "hasBrowser",
"pattern": "vs/workbench/workbench.web.main"
},
{
"when": "hasBrowser",
"pattern": "vs/workbench/workbench.web.main.js"
},
{
"when": "hasBrowser",
"pattern": "vs/workbench/~"
Expand Down Expand Up @@ -977,11 +983,13 @@
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/editor/editor.all",
"vs/editor/editor.all.js",
"vs/workbench/~",
"vs/workbench/api/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
"vs/workbench/contrib/terminal/terminal.all"
"vs/workbench/contrib/terminal/terminal.all",
"vs/workbench/contrib/terminal/terminal.all.js"
]
},
{
Expand All @@ -994,11 +1002,13 @@
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/editor/editor.all",
"vs/editor/editor.all.js",
"vs/workbench/~",
"vs/workbench/api/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
"vs/workbench/workbench.common.main"
"vs/workbench/workbench.common.main",
"vs/workbench/workbench.common.main.js"
]
},
{
Expand All @@ -1011,11 +1021,13 @@
"vs/editor/~",
"vs/editor/contrib/*/~",
"vs/editor/editor.all",
"vs/editor/editor.all.js",
"vs/workbench/~",
"vs/workbench/api/~",
"vs/workbench/services/*/~",
"vs/workbench/contrib/*/~",
"vs/workbench/workbench.common.main"
"vs/workbench/workbench.common.main",
"vs/workbench/workbench.common.main.js"
]
},
{
Expand All @@ -1025,15 +1037,15 @@
]
},
{
"target": "src/vs/{loader.d.ts,css.ts,css.build.ts,monaco.d.ts,nls.ts}",
"target": "src/vs/{loader.d.ts,css.ts,css.build.ts,monaco.d.ts,nls.ts,nls.messages.ts}",
"restrictions": []
},
{
"target": "src/vscode-dts/**",
"restrictions": []
},
{
"target": "src/{bootstrap-amd.js,bootstrap-fork.js,bootstrap-node.js,bootstrap-window.js,bootstrap.js,cli.js,main.js,server-cli.js,server-main.js}",
"target": "src/{bootstrap-amd.js,bootstrap-fork.js,bootstrap-node.js,bootstrap-window.js,cli.js,main.js,server-cli.js,server-main.js,bootstrap-cli.js,bootstrap-server.js}",
"restrictions": []
}
]
Expand Down
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ ee1655a82ebdfd38bf8792088a6602c69f7bbd94

# jrieken: new eslint-rule
4a130c40ed876644ed8af2943809d08221375408

# bpasero: ESM migration
6b924c51528e663dda5091a1493229a361676aca
50 changes: 25 additions & 25 deletions .github/workflows/monaco-editor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,34 +65,34 @@ jobs:
- name: Run Monaco Editor Checks
run: yarn monaco-compile-check

- name: Editor Distro & ESM
run: yarn gulp editor-esm
# - name: Editor Distro & ESM
# run: yarn gulp editor-esm

- name: Editor ESM sources check
working-directory: ./test/monaco
run: yarn run esm-check
# - name: Editor ESM sources check
# working-directory: ./test/monaco
# run: yarn run esm-check

- name: Typings validation prep
run: |
mkdir typings-test
# - name: Typings validation prep
# run: |
# mkdir typings-test

- name: Typings validation
working-directory: ./typings-test
run: |
yarn init -yp
../node_modules/.bin/tsc --init
echo "import '../out-monaco-editor-core';" > a.ts
../node_modules/.bin/tsc --noEmit
# - name: Typings validation
# working-directory: ./typings-test
# run: |
# yarn init -yp
# ../node_modules/.bin/tsc --init
# echo "import '../out-monaco-editor-core';" > a.ts
# ../node_modules/.bin/tsc --noEmit

- name: Package Editor with Webpack
working-directory: ./test/monaco
run: yarn run bundle-webpack
# - name: Package Editor with Webpack
# working-directory: ./test/monaco
# run: yarn run bundle-webpack

- name: Compile Editor Tests
working-directory: ./test/monaco
run: yarn run compile
# - name: Compile Editor Tests
# working-directory: ./test/monaco
# run: yarn run compile

- name: Run Editor Tests
timeout-minutes: 5
working-directory: ./test/monaco
run: yarn test
# - name: Run Editor Tests
# timeout-minutes: 5
# working-directory: ./test/monaco
# run: yarn test
4 changes: 4 additions & 0 deletions .vscode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ const extensions = [
label: 'github-authentication',
workspaceFolder: path.join(os.tmpdir(), `msft-auth-${Math.floor(Math.random() * 100000)}`),
mocha: { timeout: 60_000 }
},
{
label: 'microsoft-authentication',
mocha: { timeout: 60_000 }
}
];

Expand Down
16 changes: 16 additions & 0 deletions .vscode/extensions/vscode-selfhost-import-aid/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"configurations": [
{
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--enable-proposed-api=ms-vscode.vscode-selfhost-import-aid"
],
"name": "Launch Extension",
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"request": "launch",
"type": "extensionHost"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "vscode.typescript-language-features",
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
}
}
29 changes: 29 additions & 0 deletions .vscode/extensions/vscode-selfhost-import-aid/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "vscode-selfhost-import-aid",
"displayName": "VS Code Selfhost Import Aid",
"description": "Util to improve dealing with imports",
"engines": {
"vscode": "^1.88.0"
},
"version": "0.0.1",
"publisher": "ms-vscode",
"categories": [
"Other"
],
"activationEvents": [
"onLanguage:typescript"
],
"main": "./out/extension.js",
"repository": {
"type": "git",
"url": "https://github.com/microsoft/vscode.git"
},
"license": "MIT",
"scripts": {
"compile": "gulp compile-extension:vscode-selfhost-import-aid",
"watch": "gulp watch-extension:vscode-selfhost-import-aid"
},
"dependencies": {
"typescript": "5.5.4"
}
}
Loading

0 comments on commit 41a2040

Please sign in to comment.