protect against deleted documents

This commit is contained in:
Erich Gamma 2017-01-17 11:37:08 +01:00
Родитель 97061557b0
Коммит 97d9f8ff29
3 изменённых файлов: 185 добавлений и 183 удалений

Просмотреть файл

@ -1,16 +1,16 @@
- 0.1.7 bug fixes
- 0.1.6 Fully support the `includeDirectories` setting, issue [#24](https://github.com/Microsoft/vscode-npm-scripts/issues/24)
- 0.1.4/0.1.5 Handle the case that npm is not installed more gracefully
- 0.1.3 Guard against invalid package.json files issue [#77](https://github.com/Microsoft/vscode-npm-scripts/issues/77)
- 0.1.0 added support for validating module dependencies
- 0.0.21 added command to run `npm start`.
- 0.0.20 when commands are run in the terminal, then the **integrated terminal** is used.
- 0.0.16 added `npm install ` to the context menu on `package.json` in the explorer.
- 0.0.15 added setting to run npm commands with `--silent`.
- 0.0.15 tweaks to the README so that the extension is found when searching for node.
- 0.0.14 added command to terminate a running script
- 0.0.13 save workspace before running scripts, added command to run `npm run build`
- 0.0.12 added support for `npm.useRootDirectory`
- 0.0.11 added command to run `npm test`.
- 0.0.7 adding an icon and changed the display name to 'npm Script Runner'.
- 0.0.4 the keybinding was changed from `R` to `N` to avoid conflicts with the default `workbench.action.files.newUntitledFile` command.
- 0.1.7/0.1.8 bug fixes
- 0.1.6 Fully support the `includeDirectories` setting, issue [#24](https://github.com/Microsoft/vscode-npm-scripts/issues/24)
- 0.1.4/0.1.5 Handle the case that npm is not installed more gracefully
- 0.1.3 Guard against invalid package.json files issue [#77](https://github.com/Microsoft/vscode-npm-scripts/issues/77)
- 0.1.0 added support for validating module dependencies
- 0.0.21 added command to run `npm start`.
- 0.0.20 when commands are run in the terminal, then the **integrated terminal** is used.
- 0.0.16 added `npm install ` to the context menu on `package.json` in the explorer.
- 0.0.15 added setting to run npm commands with `--silent`.
- 0.0.15 tweaks to the README so that the extension is found when searching for node.
- 0.0.14 added command to terminate a running script
- 0.0.13 save workspace before running scripts, added command to run `npm run build`
- 0.0.12 added support for `npm.useRootDirectory`
- 0.0.11 added command to run `npm test`.
- 0.0.7 adding an icon and changed the display name to 'npm Script Runner'.
- 0.0.4 the keybinding was changed from `R` to `N` to avoid conflicts with the default `workbench.action.files.newUntitledFile` command.

Просмотреть файл

@ -1,167 +1,167 @@
{
"name": "vscode-npm-script",
"description": "npm support for VS Code",
"displayName": "npm",
"version": "0.1.7",
"publisher": "eg2",
"icon": "npm_icon.png",
"engines": {
"vscode": "^1.5.0"
},
"homepage": "https://github.com/Microsoft/vscode-npm-scripts/blob/master/README.md",
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode-npm-scripts.git"
},
"bugs": {
"url": "https://github.com/Microsoft/vscode-npm-scripts/issues"
},
"categories": [
"Other"
],
"activationEvents": [
"onLanguage:json",
"onCommand:npm-script.install",
"onCommand:npm-script.run",
"onCommand:npm-script.showOutput",
"onCommand:npm-script.rerun-last-script",
"onCommand:npm-script.terminate-script",
"onCommand:npm-script.test",
"onCommand:npm-script.start"
],
"main": "./out/src/main",
"contributes": {
"commands": [
{
"command": "npm-script.install",
"title": "Install Dependencies",
"category": "npm"
},
{
"command": "npm-script.terminate-script",
"title": "Terminate Script",
"category": "npm"
},
{
"command": "npm-script.run",
"title": "Run Script",
"category": "npm"
},
{
"command": "npm-script.start",
"title": "Start",
"category": "npm"
},
{
"command": "npm-script.showOutput",
"title": "Show Output",
"category": "npm"
},
{
"command": "npm-script.rerun-last-script",
"title": "Rerun Last Script",
"category": "npm"
},
{
"command": "npm-script.test",
"title": "Run Test",
"category": "npm"
},
{
"command": "npm-script.build",
"title": "Run Build",
"category": "npm"
}
],
"menus": {
"explorer/context": [
{
"when": "resourceFilename == 'package.json'",
"command": "npm-script.install",
"group": "navigation@+1"
}
]
},
"keybindings": [
{
"command": "npm-script.showOutput",
"key": "Ctrl+R L",
"mac": "Cmd+R L"
},
{
"command": "npm-script.run",
"key": "Ctrl+R Shift+R",
"mac": "Cmd+R Shift+R"
},
{
"command": "npm-script.rerun-last-script",
"key": "Ctrl+R R",
"mac": "Cmd+R R"
},
{
"command": "npm-script.terminate-script",
"key": "Ctrl+R Shift+X",
"mac": "Cmd+R Shift+X"
},
{
"command": "npm-script.test",
"key": "Ctrl+R T",
"mac": "Cmd+R T"
}
],
"configuration": {
"type": "object",
"title": "npm Script Runner",
"properties": {
"npm.runInTerminal": {
"type": "boolean",
"default": true,
"description": "Run npm commands in a terminal, otherwise shows the output in the output panel"
},
"npm.includeDirectories": {
"type": "array",
"default": [],
"description": "Look for 'package.json' files in these directories"
},
"npm.useRootDirectory": {
"type": "boolean",
"default": true,
"description": "Look for 'package.json' in the root directory of the workspace"
},
"npm.runSilent": {
"type": "boolean",
"default": false,
"description": "Run npm commands with the `--silent` option"
},
"npm.bin": {
"type": "string",
"default": "npm",
"description": "npm bin name"
},
"npm.validate.enable": {
"type": "boolean",
"default": true,
"description": "Validate installed modules"
}
}
}
},
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"tslint": "tslint src/*.ts"
},
"devDependencies": {
"typescript": "^2.1.4",
"vscode": "^1.0.0",
"@types/node": "^6.0.40",
"@types/mocha": "^2.2.32",
"tslint": "^4.2.0"
},
"dependencies": {
"run-in-terminal": "^0.0.2",
"tree-kill": "^1.1.0",
"jsonc-parser": "^0.2.3"
}
{
"name": "vscode-npm-script",
"description": "npm support for VS Code",
"displayName": "npm",
"version": "0.1.8",
"publisher": "eg2",
"icon": "npm_icon.png",
"engines": {
"vscode": "^1.5.0"
},
"homepage": "https://github.com/Microsoft/vscode-npm-scripts/blob/master/README.md",
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode-npm-scripts.git"
},
"bugs": {
"url": "https://github.com/Microsoft/vscode-npm-scripts/issues"
},
"categories": [
"Other"
],
"activationEvents": [
"onLanguage:json",
"onCommand:npm-script.install",
"onCommand:npm-script.run",
"onCommand:npm-script.showOutput",
"onCommand:npm-script.rerun-last-script",
"onCommand:npm-script.terminate-script",
"onCommand:npm-script.test",
"onCommand:npm-script.start"
],
"main": "./out/src/main",
"contributes": {
"commands": [
{
"command": "npm-script.install",
"title": "Install Dependencies",
"category": "npm"
},
{
"command": "npm-script.terminate-script",
"title": "Terminate Script",
"category": "npm"
},
{
"command": "npm-script.run",
"title": "Run Script",
"category": "npm"
},
{
"command": "npm-script.start",
"title": "Start",
"category": "npm"
},
{
"command": "npm-script.showOutput",
"title": "Show Output",
"category": "npm"
},
{
"command": "npm-script.rerun-last-script",
"title": "Rerun Last Script",
"category": "npm"
},
{
"command": "npm-script.test",
"title": "Run Test",
"category": "npm"
},
{
"command": "npm-script.build",
"title": "Run Build",
"category": "npm"
}
],
"menus": {
"explorer/context": [
{
"when": "resourceFilename == 'package.json'",
"command": "npm-script.install",
"group": "navigation@+1"
}
]
},
"keybindings": [
{
"command": "npm-script.showOutput",
"key": "Ctrl+R L",
"mac": "Cmd+R L"
},
{
"command": "npm-script.run",
"key": "Ctrl+R Shift+R",
"mac": "Cmd+R Shift+R"
},
{
"command": "npm-script.rerun-last-script",
"key": "Ctrl+R R",
"mac": "Cmd+R R"
},
{
"command": "npm-script.terminate-script",
"key": "Ctrl+R Shift+X",
"mac": "Cmd+R Shift+X"
},
{
"command": "npm-script.test",
"key": "Ctrl+R T",
"mac": "Cmd+R T"
}
],
"configuration": {
"type": "object",
"title": "npm Script Runner",
"properties": {
"npm.runInTerminal": {
"type": "boolean",
"default": true,
"description": "Run npm commands in a terminal, otherwise shows the output in the output panel"
},
"npm.includeDirectories": {
"type": "array",
"default": [],
"description": "Look for 'package.json' files in these directories"
},
"npm.useRootDirectory": {
"type": "boolean",
"default": true,
"description": "Look for 'package.json' in the root directory of the workspace"
},
"npm.runSilent": {
"type": "boolean",
"default": false,
"description": "Run npm commands with the `--silent` option"
},
"npm.bin": {
"type": "string",
"default": "npm",
"description": "npm bin name"
},
"npm.validate.enable": {
"type": "boolean",
"default": true,
"description": "Validate installed modules"
}
}
}
},
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"tslint": "tslint src/*.ts"
},
"devDependencies": {
"typescript": "^2.1.4",
"vscode": "^1.0.0",
"@types/node": "^6.0.40",
"@types/mocha": "^2.2.32",
"tslint": "^4.2.0"
},
"dependencies": {
"run-in-terminal": "^0.0.2",
"tree-kill": "^1.1.0",
"jsonc-parser": "^0.2.3"
}
}

Просмотреть файл

@ -502,7 +502,9 @@ async function doValidate(document: TextDocument) {
if (!anyModuleErrors(report)) {
return;
}
if (!document.getText()) {
return;
}
const sourceRanges = parseSourceRanges(document.getText());
const dependencies = report.dependencies;
const diagnostics: Diagnostic[] = [];