Skip to content

Commit 12625aa

Browse files
author
Miguel Solorio
authored
Merge branch 'master' into misolori/monokai-theme
2 parents 85fe047 + c534a1c commit 12625aa

100 files changed

Lines changed: 1314 additions & 942 deletions

File tree

Some content is hidden

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

extensions/markdown-language-features/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@
317317
"build-preview": "webpack --mode production"
318318
},
319319
"dependencies": {
320-
"highlight.js": "9.15.8",
321-
"markdown-it": "^9.1.0",
320+
"highlight.js": "9.15.10",
321+
"markdown-it": "^10.0.0",
322322
"markdown-it-front-matter": "^0.1.2",
323323
"vscode-extension-telemetry": "0.1.1",
324324
"vscode-nls": "^4.0.0"

extensions/markdown-language-features/yarn.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,10 +1973,10 @@ enhanced-resolve@^4.0.0:
19731973
memory-fs "^0.4.0"
19741974
tapable "^1.0.0"
19751975

1976-
entities@~1.1.1:
1977-
version "1.1.1"
1978-
resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0"
1979-
integrity sha1-blwtClYhtdra7O+AuQ7ftc13cvA=
1976+
entities@~2.0.0:
1977+
version "2.0.0"
1978+
resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4"
1979+
integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==
19801980

19811981
errno@^0.1.3, errno@~0.1.7:
19821982
version "0.1.7"
@@ -2933,10 +2933,10 @@ he@1.1.1:
29332933
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"
29342934
integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0=
29352935

2936-
highlight.js@9.15.8:
2937-
version "9.15.8"
2938-
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.15.8.tgz#f344fda123f36f1a65490e932cf90569e4999971"
2939-
integrity sha512-RrapkKQWwE+wKdF73VsOa2RQdIoO3mxwJ4P8mhbI6KYJUraUHRKM5w5zQQKXNk0xNL4UVRdulV9SBJcmzJNzVA==
2936+
highlight.js@9.15.10:
2937+
version "9.15.10"
2938+
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.15.10.tgz#7b18ed75c90348c045eef9ed08ca1319a2219ad2"
2939+
integrity sha512-RoV7OkQm0T3os3Dd2VHLNMoaoDVx77Wygln3n9l5YV172XonWG6rgQD3XnF/BuFFZw9A0TJgmMSO8FEWQgvcXw==
29402940

29412941
hmac-drbg@^1.0.0:
29422942
version "1.0.1"
@@ -3900,13 +3900,13 @@ markdown-it-front-matter@^0.1.2:
39003900
resolved "https://registry.yarnpkg.com/markdown-it-front-matter/-/markdown-it-front-matter-0.1.2.tgz#e50bf56e77e6a4f5ac4ffa894d4d45ccd9896b20"
39013901
integrity sha1-5Qv1bnfmpPWsT/qJTU1FzNmJayA=
39023902

3903-
markdown-it@^9.1.0:
3904-
version "9.1.0"
3905-
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-9.1.0.tgz#df9601c168568704d554b1fff9af0c5b561168d9"
3906-
integrity sha512-xHKG4C8iPriyfu/jc2hsCC045fKrMQ0VexX2F1FGYiRxDxqMB2aAhF8WauJ3fltn2kb90moGBkiiEdooGIg55w==
3903+
markdown-it@^10.0.0:
3904+
version "10.0.0"
3905+
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-10.0.0.tgz#abfc64f141b1722d663402044e43927f1f50a8dc"
3906+
integrity sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==
39073907
dependencies:
39083908
argparse "^1.0.7"
3909-
entities "~1.1.1"
3909+
entities "~2.0.0"
39103910
linkify-it "^2.0.0"
39113911
mdurl "^1.0.1"
39123912
uc.micro "^1.0.5"

extensions/npm/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ The Npm Script Explorer shows the npm scripts found in your workspace. The explo
2222
The extension supports to run the selected script as a task when editing the `package.json`file. You can either run a script from
2323
the hover shown on a script or using the command `Run Selected Npm Script`.
2424

25+
### Run Scripts from a Folder in the Explorer
26+
27+
The extension supports running a script as a task from a folder in the Explorer. The command `Run NPM Script in Folder...` shown in the Explorer context menu finds all scripts in `package.json` files that are contained in this folder. You can then select the script to be executed as a task from the resulting list. You enable this support with the `npm.runScriptFromFolder` which is `false` by default.
28+
2529
### Others
2630

2731
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.
@@ -34,5 +38,7 @@ The extension fetches data from https://registry.npmjs.org and https://registry.
3438
- `npm.exclude` - Glob patterns for folders that should be excluded from automatic script detection. The pattern is matched against the **absolute path** of the package.json. For example, to exclude all test folders use '**/test/**'.
3539
- `npm.enableScriptExplorer` - Enable an explorer view for npm scripts.
3640
- `npm.scriptExplorerAction` - The default click action: `open` or `run`, the default is `open`.
41+
- `npm.enableRunFromFolder` - Enable running npm scripts from the context menu of folders in Explorer, the default is `false`.
3742
- `npm.scriptCodeLens.enable` - Enable/disable the code lenses to run a script, the default is `false`.
3843

44+

extensions/npm/package.json

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@
8888
{
8989
"command": "npm.runSelectedScript",
9090
"title": "%command.runSelectedScript%"
91+
},
92+
{
93+
"command": "npm.runScriptFromFolder",
94+
"title": "%command.runScriptFromFolder%"
9195
}
9296
],
9397
"menus": {
@@ -115,6 +119,10 @@
115119
{
116120
"command": "npm.runSelectedScript",
117121
"when": "false"
122+
},
123+
{
124+
"command": "npm.runScriptFromFolder",
125+
"when": "false"
118126
}
119127
],
120128
"editor/context": [
@@ -172,7 +180,14 @@
172180
"when": "view == npm && viewItem == script",
173181
"group": "navigation@3"
174182
}
175-
]
183+
],
184+
"explorer/context": [
185+
{
186+
"when": "config.npm.enableRunFromFolder && explorerViewletVisible && explorerResourceIsFolder",
187+
"command": "npm.runScriptFromFolder",
188+
"group": "2_workspace"
189+
}
190+
]
176191
},
177192
"configuration": {
178193
"id": "npm",
@@ -222,6 +237,12 @@
222237
"scope": "resource",
223238
"description": "%config.npm.enableScriptExplorer%"
224239
},
240+
"npm.enableRunFromFolder": {
241+
"type": "boolean",
242+
"default": false,
243+
"scope": "resource",
244+
"description": "%config.npm.enableRunFromFolder%"
245+
},
225246
"npm.scriptExplorerAction": {
226247
"type": "string",
227248
"enum": [

extensions/npm/package.nls.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
{
22
"description": "Extension to add task support for npm scripts.",
3-
"displayName": "Npm support for VS Code",
3+
"displayName": "NPM support for VS Code",
44
"config.npm.autoDetect": "Controls whether npm scripts should be automatically detected.",
55
"config.npm.runSilent": "Run npm commands with the `--silent` option.",
66
"config.npm.packageManager": "The package manager used to run scripts.",
77
"config.npm.exclude": "Configure glob patterns for folders that should be excluded from automatic script detection.",
88
"config.npm.enableScriptExplorer": "Enable an explorer view for npm scripts when there is no top-level 'package.json' file.",
9-
"config.npm.scriptExplorerAction": "The default click action used in the scripts explorer: `open` or `run`, the default is `open`.",
9+
"config.npm.scriptExplorerAction": "The default click action used in the npm scripts explorer: `open` or `run`, the default is `open`.",
10+
"config.npm.enableRunFromFolder": "Enable running NPM scripts contained in a folder from the Explorer context menu.",
1011
"config.npm.fetchOnlinePackageInfo": "Fetch data from https://registry.npmjs.org and https://registry.bower.io to provide auto-completion and information on hover features on npm dependencies.",
1112
"npm.parseError": "Npm task detection: failed to parse the file {0}",
1213
"taskdef.script": "The npm script to customize.",
1314
"taskdef.path": "The path to the folder of the package.json file that provides the script. Can be omitted.",
14-
"view.name": "Npm Scripts",
15+
"view.name": "NPM Scripts",
1516
"command.refresh": "Refresh",
1617
"command.run": "Run",
1718
"command.debug": "Debug",
1819
"command.openScript": "Open",
1920
"command.runInstall": "Run Install",
20-
"command.runSelectedScript": "Run Script"
21+
"command.runSelectedScript": "Run Script",
22+
"command.runScriptFromFolder": "Run NPM Script in Folder..."
2123
}

extensions/npm/src/commands.ts

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import * as nls from 'vscode-nls';
67
import * as vscode from 'vscode';
8+
79
import {
8-
runScript, findScriptAtPosition
10+
detectNpmScriptsForFolder,
11+
findScriptAtPosition,
12+
runScript,
13+
FolderTaskItem
914
} from './tasks';
10-
import * as nls from 'vscode-nls';
1115

1216
const localize = nls.loadMessageBundle();
1317

@@ -28,4 +32,37 @@ export function runSelectedScript() {
2832
let message = localize('noScriptFound', 'Could not find a valid npm script at the selection.');
2933
vscode.window.showErrorMessage(message);
3034
}
31-
}
35+
}
36+
37+
export async function selectAndRunScriptFromFolder(selectedFolder: vscode.Uri) {
38+
let taskList: FolderTaskItem[] = await detectNpmScriptsForFolder(selectedFolder);
39+
40+
if (taskList && taskList.length > 0) {
41+
const quickPick = vscode.window.createQuickPick<FolderTaskItem>();
42+
quickPick.title = 'Run NPM script in Folder';
43+
quickPick.placeholder = 'Select an npm script';
44+
quickPick.items = taskList;
45+
46+
const toDispose: vscode.Disposable[] = [];
47+
48+
let pickPromise = new Promise<FolderTaskItem | undefined>((c) => {
49+
toDispose.push(quickPick.onDidAccept(() => {
50+
toDispose.forEach(d => d.dispose());
51+
c(quickPick.selectedItems[0]);
52+
}));
53+
toDispose.push(quickPick.onDidHide(() => {
54+
toDispose.forEach(d => d.dispose());
55+
c(undefined);
56+
}));
57+
});
58+
quickPick.show();
59+
let result = await pickPromise;
60+
quickPick.dispose();
61+
if (result) {
62+
vscode.tasks.executeTask(result.task);
63+
}
64+
}
65+
else {
66+
vscode.window.showInformationMessage(`No npm scripts found in ${selectedFolder.fsPath}`, { modal: true });
67+
}
68+
}

extensions/npm/src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import * as httpRequest from 'request-light';
77
import * as vscode from 'vscode';
88
import { addJSONProviders } from './features/jsonContributions';
9+
import { runSelectedScript, selectAndRunScriptFromFolder } from './commands';
910
import { NpmScriptsTreeDataProvider } from './npmView';
1011
import { invalidateTasksCache, NpmTaskProvider, hasPackageJson } from './tasks';
1112
import { invalidateHoverScriptsCache, NpmScriptHoverProvider } from './scriptHover';
12-
import { runSelectedScript } from './commands';
1313

1414
let treeDataProvider: NpmScriptsTreeDataProvider | undefined;
1515

@@ -45,6 +45,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
4545
if (await hasPackageJson()) {
4646
vscode.commands.executeCommand('setContext', 'npm:showScriptExplorer', true);
4747
}
48+
49+
context.subscriptions.push(vscode.commands.registerCommand('npm.runScriptFromFolder', selectAndRunScriptFromFolder));
4850
}
4951

5052
function registerTaskProvider(context: vscode.ExtensionContext): vscode.Disposable | undefined {

extensions/npm/src/tasks.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import {
77
TaskDefinition, Task, TaskGroup, WorkspaceFolder, RelativePattern, ShellExecution, Uri, workspace,
8-
DebugConfiguration, debug, TaskProvider, TextDocument, tasks, TaskScope
8+
DebugConfiguration, debug, TaskProvider, TextDocument, tasks, TaskScope, QuickPickItem
99
} from 'vscode';
1010
import * as path from 'path';
1111
import * as fs from 'fs';
@@ -20,6 +20,11 @@ export interface NpmTaskDefinition extends TaskDefinition {
2020
path?: string;
2121
}
2222

23+
export interface FolderTaskItem extends QuickPickItem {
24+
label: string;
25+
task: Task;
26+
}
27+
2328
type AutoDetect = 'on' | 'off';
2429

2530
let cachedTasks: Task[] | undefined = undefined;
@@ -155,6 +160,29 @@ async function detectNpmScripts(): Promise<Task[]> {
155160
}
156161
}
157162

163+
164+
export async function detectNpmScriptsForFolder(folder: Uri): Promise<FolderTaskItem[]> {
165+
166+
let folderTasks: FolderTaskItem[] = [];
167+
168+
try {
169+
let relativePattern = new RelativePattern(folder.fsPath, '**/package.json');
170+
let paths = await workspace.findFiles(relativePattern, '**/node_modules/**');
171+
172+
let visitedPackageJsonFiles: Set<string> = new Set();
173+
for (const path of paths) {
174+
if (!visitedPackageJsonFiles.has(path.fsPath)) {
175+
let tasks = await provideNpmScriptsForFolder(path);
176+
visitedPackageJsonFiles.add(path.fsPath);
177+
folderTasks.push(...tasks.map(t => ({ label: t.name, task: t })));
178+
}
179+
}
180+
return folderTasks;
181+
} catch (error) {
182+
return Promise.reject(error);
183+
}
184+
}
185+
158186
export async function provideNpmScripts(): Promise<Task[]> {
159187
if (!cachedTasks) {
160188
cachedTasks = await detectNpmScripts();

extensions/php/language-configuration.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
],
2727
"indentationRules": {
2828
"increaseIndentPattern": "({(?!.*}).*|\\(|\\[|((else(\\s)?)?if|else|for(each)?|while|switch|case).*:)\\s*((/[/*].*|)?$|\\?>)",
29-
"decreaseIndentPattern": "^(.*\\*\\/)?\\s*((\\})|(\\)+[;,])|(\\][;,])|\\b(else:)|\\b((end(if|for(each)?|while|switch));))"
29+
"decreaseIndentPattern": "^(.*\\*\\/)?\\s*((\\})|(\\)+[;,])|(\\][;,])|\\b(else:)|\\b((end(if|for(each)?|while|switch)|break);))"
3030
},
3131
"folding": {
3232
"markers": {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "code-oss-dev",
33
"version": "1.40.0",
4-
"distro": "9627858bf882fef220a55f51257dca1491763dc1",
4+
"distro": "8f2b29933a026f6754ad5093a7c10c803f0ff30f",
55
"author": {
66
"name": "Microsoft Corporation"
77
},
@@ -30,7 +30,7 @@
3030
"dependencies": {
3131
"applicationinsights": "1.0.8",
3232
"chokidar": "3.1.0",
33-
"graceful-fs": "4.2.2",
33+
"graceful-fs": "4.1.11",
3434
"http-proxy-agent": "^2.1.0",
3535
"https-proxy-agent": "^2.2.1",
3636
"iconv-lite": "0.5.0",
@@ -153,4 +153,4 @@
153153
"windows-mutex": "0.3.0",
154154
"windows-process-tree": "0.2.4"
155155
}
156-
}
156+
}

0 commit comments

Comments
 (0)