Merge remote-tracking branch 'upstream/master' into rmacfarlane/review

This commit is contained in:
Peng Lyu 2018-06-04 11:14:31 -07:00
commit ad635f2b4c
1466 changed files with 34753 additions and 22881 deletions

View file

@ -1,8 +1,10 @@
<!--
Do you have a question? Please ask it on https://stackoverflow.com/questions/tagged/vscode.
---
name: Bug report
about: Create a report to help us improve
For bug reports, please fill in the details below. For feature requests, please describe the desired feature.
-->
---
<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Use Help > Report Issue to prefill these. -->
- VSCode Version:

View file

@ -0,0 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
---
<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Describe the feature you'd like. -->

9
.github/ISSUE_TEMPLATE/question.md vendored Normal file
View file

@ -0,0 +1,9 @@
---
name: Question
about: The issue tracker is not for questions. Please ask questions on https://stackoverflow.com/questions/tagged/vscode.
---
🚨 The issue tracker is not for questions 🚨
If you have a question, please ask it on https://stackoverflow.com/questions/tagged/vscode.

View file

@ -19,4 +19,7 @@
'2018-05-08 12:00, US/Pacific': 'development',
'2018-05-10 12:00, US/Pacific': 'release', # 1.23.1
'2018-05-15 12:00, US/Pacific': 'development',
'2018-05-28 18:00, US/Pacific': 'endgame',
# 'release' not needed anymore, return to 'development' after releasing 1.24.0:
# '2018-06-06 18:00, US/Pacific': 'development',
}

View file

@ -10,7 +10,7 @@
color-picker: [],
css-less-sass: [ aeschli ],
debug: {
assignees: [ roblourens ],
assignees: [ weinand ],
assignLabel: false
},
diff-editor: [],

View file

@ -1,6 +1,6 @@
{
newReleaseLabel: 'new release',
newReleaseColor: '006b75',
action: 'remove',
daysAfterRelease: 7,
perform: true
}

View file

@ -1,6 +0,0 @@
{
newReleaseLabel: 'new release',
newReleaseColor: '006b75',
action: 'add',
perform: true
}

2
.vscode/launch.json vendored
View file

@ -18,7 +18,7 @@
"name": "Attach to Extension Host",
"protocol": "inspector",
"port": 5870,
// "restart": true,
"restart": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
]

View file

@ -1161,5 +1161,176 @@
" This Source Code Form is \"Incompatible With Secondary Licenses\", as",
" defined by the Mozilla Public License, v. 2.0."
]
},
{
"isLicense": true,
"name": "devtools-protocol",
"licenseDetail": [
" Copyright 2015 The Chromium Authors. All rights reserved.",
"",
" Redistribution and use in source and binary forms, with or without",
" modification, are permitted provided that the following conditions are",
" met:",
"",
" * Redistributions of source code must retain the above copyright",
" notice, this list of conditions and the following disclaimer.",
" * Redistributions in binary form must reproduce the above",
" copyright notice, this list of conditions and the following disclaimer",
" in the documentation and/or other materials provided with the",
" distribution.",
" * Neither the name of Google Inc. nor the names of its",
" contributors may be used to endorse or promote products derived from",
" this software without specific prior written permission.",
"",
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS",
" \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT",
" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR",
" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT",
" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,",
" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT",
" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,",
" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY",
" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT",
" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE",
" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
]
},
{
"isLicense": true,
"name": "buffer-alloc",
"licenseDetail": [
"This project is licensed under the MIT license.",
"Copyrights are respective of each contributor listed at the beginning of each definition file.",
"",
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:",
"",
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
]
},
{
"isLicense": true,
"name": "expand-template",
"licenseDetail": [
" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE",
" Version 2, December 2004",
"",
" Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>",
"",
" Everyone is permitted to copy and distribute verbatim or modified",
" copies of this license document, and changing it is allowed as long",
" as the name is changed.",
"",
" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE",
" TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION",
"",
" 0. You just DO WHAT THE FUCK YOU WANT TO."
]
},
{
"isLicense": true,
"name": "tunnel-agent",
"licenseDetail": [
"Copyright (c) tunnel-agent authors",
"",
"Apache License",
"",
"Version 2.0, January 2004",
"",
"http://www.apache.org/licenses/",
"",
"TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION",
"",
"1. Definitions.",
"",
"\"License\" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.",
"",
"\"Licensor\" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.",
"",
"\"Legal Entity\" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, \"control\" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.",
"",
"\"You\" (or \"Your\") shall mean an individual or Legal Entity exercising permissions granted by this License.",
"",
"\"Source\" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.",
"",
"\"Object\" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.",
"",
"\"Work\" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).",
"",
"\"Derivative Works\" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.",
"",
"\"Contribution\" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, \"submitted\" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as \"Not a Contribution.\"",
"",
"\"Contributor\" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.",
"",
"2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.",
"",
"3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.",
"",
"4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:",
"",
"You must give any other recipients of the Work or Derivative Works a copy of this License; and",
"",
"You must cause any modified files to carry prominent notices stating that You changed the files; and",
"",
"You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and",
"",
"If the Work includes a \"NOTICE\" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.",
"",
"5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.",
"",
"6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.",
"",
"7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.",
"",
"8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.",
"",
"9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.",
"",
"END OF TERMS AND CONDITIONS"
]
},
{
"isLicense": true,
"name": "noop-logger",
"licenseDetail": [
"This project is licensed under the MIT license.",
"Copyrights are respective of each contributor listed at the beginning of each definition file.",
"",
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:",
"",
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
]
},
{
"isLicense": true,
"name": "buffer-alloc-unsafe",
"licenseDetail": [
"This project is licensed under the MIT license.",
"Copyrights are respective of each contributor listed at the beginning of each definition file.",
"",
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:",
"",
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
]
},
{
"isLicense": true,
"name": "buffer-fill",
"licenseDetail": [
"This project is licensed under the MIT license.",
"Copyrights are respective of each contributor listed at the beginning of each definition file.",
"",
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:",
"",
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
]
}
]

View file

@ -18,7 +18,7 @@ This project incorporates components from the projects listed below. The origina
11. chriskempson/tomorrow-theme (https://github.com/chriskempson/tomorrow-theme)
12. Colorsublime-Themes version 0.1.0 (https://github.com/Colorsublime/Colorsublime-Themes)
13. daaain/Handlebars (https://github.com/daaain/Handlebars)
14. davidrios/jade-tmbundle (https://github.com/davidrios/jade-tmbundle)
14. davidrios/pug-tmbundle (https://github.com/davidrios/pug-tmbundle)
15. definitelytyped (https://github.com/DefinitelyTyped/DefinitelyTyped)
16. demyte/language-cshtml (https://github.com/demyte/language-cshtml)
17. dotnet/csharp-tmLanguage version 0.1.0 (https://github.com/dotnet/csharp-tmLanguage)
@ -535,25 +535,30 @@ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
=========================================
END OF daaain/Handlebars NOTICES AND INFORMATION
%% davidrios/jade-tmbundle NOTICES AND INFORMATION BEGIN HERE
%% davidrios/pug-tmbundle NOTICES AND INFORMATION BEGIN HERE
=========================================
The MIT License (MIT)
Copyright (c) 2014 David Rios
Copyright (c) 2016 David Rios
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to
whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=========================================
END OF davidrios/jade-tmbundle NOTICES AND INFORMATION
END OF davidrios/pug-tmbundle NOTICES AND INFORMATION
%% definitelytyped NOTICES AND INFORMATION BEGIN HERE
=========================================

View file

@ -1,7 +1,7 @@
[
{
"name": "ms-vscode.node-debug",
"version": "1.23.3",
"version": "1.24.0",
"repo": "https://github.com/Microsoft/vscode-node-debug"
},
{

View file

@ -104,7 +104,7 @@ const copyrightFilter = [
'!build/**/*.init',
'!resources/linux/snap/snapcraft.yaml',
'!resources/win32/bin/code.js',
'!extensions/markdown-language-features/media/tomorrow.css',
'!extensions/markdown-language-features/media/highlight.css',
'!extensions/html-language-features/server/src/modes/typescript/*',
'!extensions/*/server/bin/*'
];

View file

@ -141,7 +141,7 @@ const config = {
name: product.nameLong + ' document',
role: 'Editor',
ostypes: ["TEXT", "utxt", "TUTX", "****"],
extensions: ["ascx", "asp", "aspx", "bash", "bash_login", "bash_logout", "bash_profile", "bashrc", "bat", "bowerrc", "c", "cc", "clj", "cljs", "cljx", "clojure", "cmd", "code-workspace", "coffee", "config", "cpp", "cs", "cshtml", "csproj", "css", "csx", "ctp", "cxx", "dockerfile", "dot", "dtd", "editorconfig", "edn", "eyaml", "eyml", "fs", "fsi", "fsscript", "fsx", "gemspec", "gitattributes", "gitconfig", "gitignore", "go", "h", "handlebars", "hbs", "hh", "hpp", "htm", "html", "hxx", "ini", "jade", "jav", "java", "js", "jscsrc", "jshintrc", "jshtm", "json", "jsp", "less", "lua", "m", "makefile", "markdown", "md", "mdoc", "mdown", "mdtext", "mdtxt", "mdwn", "mkd", "mkdn", "ml", "mli", "php", "phtml", "pl", "pl6", "pm", "pm6", "pod", "pp", "profile", "properties", "ps1", "psd1", "psgi", "psm1", "py", "r", "rb", "rhistory", "rprofile", "rs", "rt", "scss", "sh", "shtml", "sql", "svg", "svgz", "t", "ts", "txt", "vb", "wxi", "wxl", "wxs", "xaml", "xcodeproj", "xcworkspace", "xml", "yaml", "yml", "zlogin", "zlogout", "zprofile", "zsh", "zshenv", "zshrc"],
extensions: ["ascx", "asp", "aspx", "bash", "bash_login", "bash_logout", "bash_profile", "bashrc", "bat", "bowerrc", "c", "cc", "clj", "cljs", "cljx", "clojure", "cmd", "code-workspace", "coffee", "config", "cpp", "cs", "cshtml", "csproj", "css", "csx", "ctp", "cxx", "dockerfile", "dot", "dtd", "editorconfig", "edn", "eyaml", "eyml", "fs", "fsi", "fsscript", "fsx", "gemspec", "gitattributes", "gitconfig", "gitignore", "go", "h", "handlebars", "hbs", "hh", "hpp", "htm", "html", "hxx", "ini", "jade", "jav", "java", "js", "jscsrc", "jshintrc", "jshtm", "json", "jsp", "less", "lua", "m", "makefile", "markdown", "md", "mdoc", "mdown", "mdtext", "mdtxt", "mdwn", "mkd", "mkdn", "ml", "mli", "php", "phtml", "pl", "pl6", "pm", "pm6", "pod", "pp", "profile", "properties", "ps1", "psd1", "psgi", "psm1", "pug", "py", "r", "rb", "rhistory", "rprofile", "rs", "rt", "scss", "sh", "shtml", "sql", "svg", "svgz", "t", "ts", "txt", "vb", "wxi", "wxl", "wxs", "xaml", "xcodeproj", "xcworkspace", "xml", "yaml", "yml", "zlogin", "zlogout", "zprofile", "zsh", "zshenv", "zshrc"],
iconFile: 'resources/darwin/code_file.icns'
}],
darwinBundleURLTypes: [{

View file

@ -44,6 +44,7 @@ function error(err) {
var baseHeaders = {
'X-Market-Client-Id': 'VSCode Build',
'User-Agent': 'VSCode Build',
'X-Market-User-Id': '291C1CD0-051A-4123-9B4B-30D60EF52EE2',
};
function fromMarketplace(extensionName, version) {
var filterType = 7;

View file

@ -49,6 +49,7 @@ function error(err: any): Stream {
const baseHeaders = {
'X-Market-Client-Id': 'VSCode Build',
'User-Agent': 'VSCode Build',
'X-Market-User-Id': '291C1CD0-051A-4123-9B4B-30D60EF52EE2',
};
export function fromMarketplace(extensionName: string, version: string): Stream {

View file

@ -0,0 +1,72 @@
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var ts = require("typescript");
var Lint = require("tslint");
var path_1 = require("path");
var Rule = /** @class */ (function (_super) {
__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
Rule.prototype.apply = function (sourceFile) {
if (/vs(\/|\\)editor/.test(sourceFile.fileName)) {
// the vs/editor folder is allowed to use the standalone editor
return [];
}
return this.applyWithWalker(new NoStandaloneEditorRuleWalker(sourceFile, this.getOptions()));
};
return Rule;
}(Lint.Rules.AbstractRule));
exports.Rule = Rule;
var NoStandaloneEditorRuleWalker = /** @class */ (function (_super) {
__extends(NoStandaloneEditorRuleWalker, _super);
function NoStandaloneEditorRuleWalker(file, opts) {
return _super.call(this, file, opts) || this;
}
NoStandaloneEditorRuleWalker.prototype.visitImportEqualsDeclaration = function (node) {
if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) {
this._validateImport(node.moduleReference.expression.getText(), node);
}
};
NoStandaloneEditorRuleWalker.prototype.visitImportDeclaration = function (node) {
this._validateImport(node.moduleSpecifier.getText(), node);
};
NoStandaloneEditorRuleWalker.prototype.visitCallExpression = function (node) {
_super.prototype.visitCallExpression.call(this, node);
// import('foo') statements inside the code
if (node.expression.kind === ts.SyntaxKind.ImportKeyword) {
var path = node.arguments[0];
this._validateImport(path.getText(), node);
}
};
NoStandaloneEditorRuleWalker.prototype._validateImport = function (path, node) {
// remove quotes
path = path.slice(1, -1);
// resolve relative paths
if (path[0] === '.') {
path = path_1.join(this.getSourceFile().fileName, path);
}
if (/vs(\/|\\)editor(\/|\\)standalone/.test(path)
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone/.test(path)
|| /vs(\/|\\)editor(\/|\\)editor.api/.test(path)
|| /vs(\/|\\)editor(\/|\\)editor.main/.test(path)
|| /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) {
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), "Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization"));
}
};
return NoStandaloneEditorRuleWalker;
}(Lint.RuleWalker));

View file

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as ts from 'typescript';
import * as Lint from 'tslint';
import { join } from 'path';
export class Rule extends Lint.Rules.AbstractRule {
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
if (/vs(\/|\\)editor/.test(sourceFile.fileName)) {
// the vs/editor folder is allowed to use the standalone editor
return [];
}
return this.applyWithWalker(new NoStandaloneEditorRuleWalker(sourceFile, this.getOptions()));
}
}
class NoStandaloneEditorRuleWalker extends Lint.RuleWalker {
constructor(file: ts.SourceFile, opts: Lint.IOptions) {
super(file, opts);
}
protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void {
if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) {
this._validateImport(node.moduleReference.expression.getText(), node);
}
}
protected visitImportDeclaration(node: ts.ImportDeclaration): void {
this._validateImport(node.moduleSpecifier.getText(), node);
}
protected visitCallExpression(node: ts.CallExpression): void {
super.visitCallExpression(node);
// import('foo') statements inside the code
if (node.expression.kind === ts.SyntaxKind.ImportKeyword) {
const [path] = node.arguments;
this._validateImport(path.getText(), node);
}
}
private _validateImport(path: string, node: ts.Node): void {
// remove quotes
path = path.slice(1, -1);
// resolve relative paths
if (path[0] === '.') {
path = join(this.getSourceFile().fileName, path);
}
if (
/vs(\/|\\)editor(\/|\\)standalone/.test(path)
|| /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone/.test(path)
|| /vs(\/|\\)editor(\/|\\)editor.api/.test(path)
|| /vs(\/|\\)editor(\/|\\)editor.main/.test(path)
|| /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)
) {
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization`));
}
}
}

View file

@ -83,7 +83,7 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'mas
grammar = plist.parse(content);
} else if (ext === '.cson') {
grammar = cson.parse(content);
} else if (ext === '.json') {
} else if (ext === '.json' || ext === '.JSON-tmLanguage') {
grammar = JSON.parse(content);
} else {
return Promise.reject(new Error('Unknown file extension: ' + ext));

View file

@ -8,9 +8,13 @@ phases:
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
inputs:
versionSpec: "1.3.2"
- powershell: |
yarn
displayName: Install Dependencies
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-task.Yarn@2
displayName: Yarn
inputs:
customRegistry: useFeed
customFeed: 'd28dd4e6-8e53-406e-8887-22f7c4dffd0c'
# - task: npmAuthenticate@0
# displayName: NPM Authenticate
- powershell: |
yarn gulp electron
displayName: Download Electron
@ -61,9 +65,13 @@ phases:
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
inputs:
versionSpec: "1.3.2"
- script: |
yarn
displayName: Install Dependencies
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-task.Yarn@2
displayName: Yarn
inputs:
customRegistry: useFeed
customFeed: 'd28dd4e6-8e53-406e-8887-22f7c4dffd0c'
# - task: npmAuthenticate@0
# displayName: NPM Authenticate
- script: |
yarn gulp electron-x64
displayName: Download Electron
@ -92,9 +100,13 @@ phases:
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
inputs:
versionSpec: "1.3.2"
- script: |
yarn
displayName: Install Dependencies
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-task.Yarn@2
displayName: Yarn
inputs:
customRegistry: useFeed
customFeed: 'd28dd4e6-8e53-406e-8887-22f7c4dffd0c'
# - task: npmAuthenticate@0
# displayName: NPM Authenticate
- script: |
yarn gulp electron-x64
displayName: Download Electron

View file

@ -119,13 +119,16 @@ function registerVariableCompletions(pattern: string): vscode.Disposable {
provideCompletionItems(document, position, token) {
const location = getLocation(document.getText(), document.offsetAt(position));
if (!location.isAtPropertyKey && location.previousNode && location.previousNode.type === 'string') {
const indexOf$ = document.lineAt(position.line).text.indexOf('$');
const startPosition = indexOf$ >= 0 ? new vscode.Position(position.line, indexOf$) : position;
return [{ label: 'workspaceFolder', detail: localize('workspaceFolder', "The path of the folder opened in VS Code") }, { label: 'workspaceFolderBasename', detail: localize('workspaceFolderBasename', "The name of the folder opened in VS Code without any slashes (/)") },
{ label: 'relativeFile', detail: localize('relativeFile', "The current opened file relative to ${workspaceFolder}") }, { label: 'file', detail: localize('file', "The current opened file") }, { label: 'cwd', detail: localize('cwd', "The task runner's current working directory on startup") },
{ label: 'lineNumber', detail: localize('lineNumber', "The current selected line number in the active file") }, { label: 'selectedText', detail: localize('selectedText', "The current selected text in the active file") },
{ label: 'fileDirname', detail: localize('fileDirname', "The current opened file's dirname") }, { label: 'fileExtname', detail: localize('fileExtname', "The current opened file's extension") }, { label: 'fileBasename', detail: localize('fileBasename', "The current opened file's basename") },
{ label: 'fileBasenameNoExtension', detail: localize('fileBasenameNoExtension', "The current opened file's basename with no file extension") }].map(variable => ({
label: '${' + variable.label + '}',
range: new vscode.Range(position, position),
range: new vscode.Range(startPosition, position),
detail: variable.detail
}));
}

View file

@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/dotnet/csharp-tmLanguage/commit/925295380addea5b27f419a423c708f421347c5c",
"version": "https://github.com/dotnet/csharp-tmLanguage/commit/2904dae001939996c6a3484eac1b95716797ac41",
"name": "C#",
"scopeName": "source.cs",
"patterns": [
@ -3588,7 +3588,7 @@
]
},
"lambda-parameter": {
"match": "(?x)\n(?:\\b(ref|out|in)\\b)?\\s*\n(?<type-name>\n (?:\n (?:\n (?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)?\n(\\g<identifier>)\\b\\s*\n(?=[,)])",
"match": "(?x)\n(?:\\b(ref|out|in)\\b)?\\s*\n(?:(?<type-name>\n (?:\n (?:\n (?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\\s*\\:\\:\\s*)? # alias-qualification\n (?<name-and-type-args> # identifier + type arguments (if any)\n \\g<identifier>\\s*\n (?<type-args>\\s*<(?:[^<>]|\\g<type-args>)+>\\s*)?\n )\n (?:\\s*\\.\\s*\\g<name-and-type-args>)* | # Are there any more names being dotted into?\n (?<tuple>\\s*\\((?:[^\\(\\)]|\\g<tuple>)+\\))\n )\n (?:\\s*\\?\\s*)? # nullable suffix?\n (?:\\s*\\[(?:\\s*,\\s*)*\\]\\s*)* # array suffix?\n )\n)\\s+)?\n(\\g<identifier>)\\b\\s*\n(?=[,)])",
"captures": {
"1": {
"name": "storage.modifier.cs"

View file

@ -695,9 +695,9 @@
]
},
"dependencies": {
"vscode-languageclient": "^4.0.0",
"vscode-languageserver-protocol-foldingprovider": "^2.0.0-next.2",
"vscode-nls": "^3.2.1"
"vscode-languageclient": "^4.1.4",
"vscode-languageserver-protocol-foldingprovider": "^2.0.1",
"vscode-nls": "^3.2.2"
},
"devDependencies": {
"@types/node": "7.0.43"

View file

@ -8,9 +8,9 @@
"node": "*"
},
"dependencies": {
"vscode-css-languageservice": "^3.0.9-next.14",
"vscode-languageserver": "^4.0.0",
"vscode-languageserver-protocol-foldingprovider": "^2.0.0-next.2"
"vscode-css-languageservice": "^3.0.9-next.18",
"vscode-languageserver": "^4.1.3",
"vscode-languageserver-protocol-foldingprovider": "^2.0.1"
},
"devDependencies": {
"@types/mocha": "2.2.33",

View file

@ -24,7 +24,7 @@ export interface Settings {
}
// Create a connection for the server.
let connection: IConnection = createConnection();
const connection: IConnection = createConnection();
console.log = connection.console.log.bind(connection.console);
console.error = connection.console.error.bind(connection.console);
@ -35,12 +35,12 @@ process.on('unhandledRejection', (e: any) => {
// Create a simple text document manager. The text document manager
// supports full document sync only
let documents: TextDocuments = new TextDocuments();
const documents: TextDocuments = new TextDocuments();
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);
let stylesheets = getLanguageModelCache<Stylesheet>(10, 60, document => getLanguageService(document).parseStylesheet(document));
const stylesheets = getLanguageModelCache<Stylesheet>(10, 60, document => getLanguageService(document).parseStylesheet(document));
documents.onDidClose(e => {
stylesheets.onDocumentRemoved(e.document);
});
@ -64,7 +64,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
}
function getClientCapability<T>(name: string, def: T) {
let keys = name.split('.');
const keys = name.split('.');
let c: any = params.capabilities;
for (let i = 0; c && i < keys.length; i++) {
if (!c.hasOwnProperty(keys[i])) {
@ -74,11 +74,11 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
}
return c;
}
let snippetSupport = !!getClientCapability('textDocument.completion.completionItem.snippetSupport', false);
const snippetSupport = !!getClientCapability('textDocument.completion.completionItem.snippetSupport', false);
scopedSettingsSupport = !!getClientCapability('workspace.configuration', false);
foldingRangeLimit = getClientCapability('textDocument.foldingRange.rangeLimit', Number.MAX_VALUE);
let capabilities: ServerCapabilities & FoldingRangeServerCapabilities = {
const capabilities: ServerCapabilities & FoldingRangeServerCapabilities = {
// Tell the client that the server works in FULL text document sync mode
textDocumentSync: documents.syncKind,
completionProvider: snippetSupport ? { resolveProvider: false, triggerCharacters: ['/'] } : undefined,
@ -95,7 +95,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
return { capabilities };
});
let languageServices: { [id: string]: LanguageService } = {
const languageServices: { [id: string]: LanguageService } = {
css: getCSSLanguageService(),
scss: getSCSSLanguageService(),
less: getLESSLanguageService()
@ -119,7 +119,7 @@ function getDocumentSettings(textDocument: TextDocument): Thenable<LanguageSetti
if (scopedSettingsSupport) {
let promise = documentSettings[textDocument.uri];
if (!promise) {
let configRequestParam = { items: [{ scopeUri: textDocument.uri, section: textDocument.languageId }] };
const configRequestParam = { items: [{ scopeUri: textDocument.uri, section: textDocument.languageId }] };
promise = connection.sendRequest(ConfigurationRequest.type, configRequestParam).then(s => s[0]);
documentSettings[textDocument.uri] = promise;
}
@ -134,7 +134,7 @@ connection.onDidChangeConfiguration(change => {
});
function updateConfiguration(settings: Settings) {
for (let languageId in languageServices) {
for (const languageId in languageServices) {
languageServices[languageId].configure((settings as any)[languageId]);
}
// reset all document settings
@ -143,7 +143,7 @@ function updateConfiguration(settings: Settings) {
documents.all().forEach(triggerValidation);
}
let pendingValidationRequests: { [uri: string]: NodeJS.Timer } = {};
const pendingValidationRequests: { [uri: string]: NodeJS.Timer } = {};
const validationDelayMs = 500;
// The content of a text document has changed. This event is emitted
@ -159,7 +159,7 @@ documents.onDidClose(event => {
});
function cleanPendingValidation(textDocument: TextDocument): void {
let request = pendingValidationRequests[textDocument.uri];
const request = pendingValidationRequests[textDocument.uri];
if (request) {
clearTimeout(request);
delete pendingValidationRequests[textDocument.uri];
@ -175,10 +175,10 @@ function triggerValidation(textDocument: TextDocument): void {
}
function validateTextDocument(textDocument: TextDocument): void {
let settingsPromise = getDocumentSettings(textDocument);
const settingsPromise = getDocumentSettings(textDocument);
settingsPromise.then(settings => {
let stylesheet = stylesheets.get(textDocument);
let diagnostics = getLanguageService(textDocument).doValidation(textDocument, stylesheet, settings);
const stylesheet = stylesheets.get(textDocument);
const diagnostics = getLanguageService(textDocument).doValidation(textDocument, stylesheet, settings);
// Send the computed diagnostics to VSCode.
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
}, e => {
@ -188,14 +188,17 @@ function validateTextDocument(textDocument: TextDocument): void {
connection.onCompletion((textDocumentPosition, token) => {
return runSafe(() => {
let document = documents.get(textDocumentPosition.textDocument.uri);
const document = documents.get(textDocumentPosition.textDocument.uri);
if (!document) {
return null;
}
const cssLS = getLanguageService(document);
const pathCompletionList: CompletionList = {
isIncomplete: false,
items: []
};
cssLS.setCompletionParticipants([getPathCompletionParticipant(document, workspaceFolders, pathCompletionList)]);
const result = cssLS.doComplete(document, textDocumentPosition.position, stylesheets.get(document))!; /* TODO: remove ! once LS has null annotations */
const result = cssLS.doComplete(document, textDocumentPosition.position, stylesheets.get(document));
return {
isIncomplete: pathCompletionList.isIncomplete,
items: [...pathCompletionList.items, ...result.items]
@ -205,57 +208,76 @@ connection.onCompletion((textDocumentPosition, token) => {
connection.onHover((textDocumentPosition, token) => {
return runSafe(() => {
let document = documents.get(textDocumentPosition.textDocument.uri);
let styleSheet = stylesheets.get(document);
return getLanguageService(document).doHover(document, textDocumentPosition.position, styleSheet);
const document = documents.get(textDocumentPosition.textDocument.uri);
if (document) {
const styleSheet = stylesheets.get(document);
return getLanguageService(document).doHover(document, textDocumentPosition.position, styleSheet);
}
return null;
}, null, `Error while computing hover for ${textDocumentPosition.textDocument.uri}`, token);
});
connection.onDocumentSymbol((documentSymbolParams, token) => {
return runSafe(() => {
let document = documents.get(documentSymbolParams.textDocument.uri);
let stylesheet = stylesheets.get(document);
return getLanguageService(document).findDocumentSymbols(document, stylesheet);
const document = documents.get(documentSymbolParams.textDocument.uri);
if (document) {
const stylesheet = stylesheets.get(document);
return getLanguageService(document).findDocumentSymbols(document, stylesheet);
}
return [];
}, [], `Error while computing document symbols for ${documentSymbolParams.textDocument.uri}`, token);
});
connection.onDefinition((documentSymbolParams, token) => {
return runSafe(() => {
let document = documents.get(documentSymbolParams.textDocument.uri);
let stylesheet = stylesheets.get(document);
return getLanguageService(document).findDefinition(document, documentSymbolParams.position, stylesheet);
const document = documents.get(documentSymbolParams.textDocument.uri);
if (document) {
const stylesheet = stylesheets.get(document);
return getLanguageService(document).findDefinition(document, documentSymbolParams.position, stylesheet);
}
return null;
}, null, `Error while computing definitions for ${documentSymbolParams.textDocument.uri}`, token);
});
connection.onDocumentHighlight((documentSymbolParams, token) => {
return runSafe(() => {
let document = documents.get(documentSymbolParams.textDocument.uri);
let stylesheet = stylesheets.get(document);
return getLanguageService(document).findDocumentHighlights(document, documentSymbolParams.position, stylesheet);
const document = documents.get(documentSymbolParams.textDocument.uri);
if (document) {
const stylesheet = stylesheets.get(document);
return getLanguageService(document).findDocumentHighlights(document, documentSymbolParams.position, stylesheet);
}
return [];
}, [], `Error while computing document highlights for ${documentSymbolParams.textDocument.uri}`, token);
});
connection.onReferences((referenceParams, token) => {
return runSafe(() => {
let document = documents.get(referenceParams.textDocument.uri);
let stylesheet = stylesheets.get(document);
return getLanguageService(document).findReferences(document, referenceParams.position, stylesheet);
const document = documents.get(referenceParams.textDocument.uri);
if (document) {
const stylesheet = stylesheets.get(document);
return getLanguageService(document).findReferences(document, referenceParams.position, stylesheet);
}
return [];
}, [], `Error while computing references for ${referenceParams.textDocument.uri}`, token);
});
connection.onCodeAction((codeActionParams, token) => {
return runSafe(() => {
let document = documents.get(codeActionParams.textDocument.uri);
let stylesheet = stylesheets.get(document);
return getLanguageService(document).doCodeActions(document, codeActionParams.range, codeActionParams.context, stylesheet);
const document = documents.get(codeActionParams.textDocument.uri);
if (document) {
const stylesheet = stylesheets.get(document);
return getLanguageService(document).doCodeActions(document, codeActionParams.range, codeActionParams.context, stylesheet);
}
return [];
}, [], `Error while computing code actions for ${codeActionParams.textDocument.uri}`, token);
});
connection.onDocumentColor((params, token) => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
const document = documents.get(params.textDocument.uri);
if (document) {
let stylesheet = stylesheets.get(document);
const stylesheet = stylesheets.get(document);
return getLanguageService(document).findDocumentColors(document, stylesheet);
}
return [];
@ -264,9 +286,9 @@ connection.onDocumentColor((params, token) => {
connection.onColorPresentation((params, token) => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
const document = documents.get(params.textDocument.uri);
if (document) {
let stylesheet = stylesheets.get(document);
const stylesheet = stylesheets.get(document);
return getLanguageService(document).getColorPresentations(document, stylesheet, params.color, params.range);
}
return [];
@ -275,16 +297,22 @@ connection.onColorPresentation((params, token) => {
connection.onRenameRequest((renameParameters, token) => {
return runSafe(() => {
let document = documents.get(renameParameters.textDocument.uri);
let stylesheet = stylesheets.get(document);
return getLanguageService(document).doRename(document, renameParameters.position, renameParameters.newName, stylesheet);
const document = documents.get(renameParameters.textDocument.uri);
if (document) {
const stylesheet = stylesheets.get(document);
return getLanguageService(document).doRename(document, renameParameters.position, renameParameters.newName, stylesheet);
}
return null;
}, null, `Error while computing renames for ${renameParameters.textDocument.uri}`, token);
});
connection.onRequest(FoldingRangeRequest.type, (params, token) => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
return getLanguageService(document).getFoldingRanges(document, { rangeLimit: foldingRangeLimit });
const document = documents.get(params.textDocument.uri);
if (document) {
return getLanguageService(document).getFoldingRanges(document, { rangeLimit: foldingRangeLimit });
}
return null;
}, null, `Error while computing folding ranges for ${params.textDocument.uri}`, token);
});

View file

@ -10,43 +10,43 @@
version "7.0.43"
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.43.tgz#a187e08495a075f200ca946079c914e1a5fe962c"
vscode-css-languageservice@^3.0.9-next.14:
version "3.0.9-next.14"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-3.0.9-next.14.tgz#156822b2d8c56487ffd47105cc884fa3983664ca"
vscode-css-languageservice@^3.0.9-next.18:
version "3.0.9-next.18"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-3.0.9-next.18.tgz#f8f25123b5a8cdc9f72fafcd2c0088f726322437"
dependencies:
vscode-languageserver-types "^3.6.1"
vscode-nls "^3.2.1"
vscode-languageserver-types "^3.7.2"
vscode-nls "^3.2.2"
vscode-jsonrpc@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0.tgz#848d56995d5168950d84feb5d9c237ae5c6a02d4"
vscode-jsonrpc@^3.6.2:
version "3.6.2"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.2.tgz#3b5eef691159a15556ecc500e9a8a0dd143470c8"
vscode-languageserver-protocol-foldingprovider@^2.0.0-next.2:
version "2.0.0-next.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.0-next.2.tgz#fbb9cfdf5b8c4ac451826ba6312f1f88379f35b0"
vscode-languageserver-protocol-foldingprovider@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.1.tgz#051d0d9e58d1b79dc4681acd48f21797f5515bfd"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-languageserver-protocol "^3.7.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-protocol@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.6.0.tgz#579642cdcccf74b0cd771c33daa3239acb40d040"
vscode-languageserver-protocol@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.7.2.tgz#df58621c032139010888b6a9ddc969423f9ba9d6"
dependencies:
vscode-jsonrpc "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-jsonrpc "^3.6.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-types@^3.6.0, vscode-languageserver-types@^3.6.1:
version "3.6.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.1.tgz#4bc06a48dff653495f12f94b8b1e228988a1748d"
vscode-languageserver-types@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.7.2.tgz#aad8846f8e3e27962648554de5a8417e358f34eb"
vscode-languageserver@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-4.0.0.tgz#8b792f0d6d10acfe363d02371ed4ce53d08af88a"
vscode-languageserver@^4.1.3:
version "4.1.3"
resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-4.1.3.tgz#937d37c955b6b9c2409388413cd6f54d1eb9fe7d"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-protocol "^3.7.2"
vscode-uri "^1.0.1"
vscode-nls@^3.2.1:
vscode-nls@^3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.2.tgz#3817eca5b985c2393de325197cf4e15eb2aa5350"

View file

@ -6,34 +6,34 @@
version "7.0.43"
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.43.tgz#a187e08495a075f200ca946079c914e1a5fe962c"
vscode-jsonrpc@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0.tgz#848d56995d5168950d84feb5d9c237ae5c6a02d4"
vscode-jsonrpc@^3.6.2:
version "3.6.2"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.2.tgz#3b5eef691159a15556ecc500e9a8a0dd143470c8"
vscode-languageclient@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.0.0.tgz#635f5bfbcfa1385dae489b394857f1db8b459a7d"
vscode-languageclient@^4.1.4:
version "4.1.4"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.1.4.tgz#fff1a6bca4714835dca7fce35bc4ce81442fdf2c"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-protocol "^3.7.2"
vscode-languageserver-protocol-foldingprovider@^2.0.0-next.2:
version "2.0.0-next.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.0-next.2.tgz#fbb9cfdf5b8c4ac451826ba6312f1f88379f35b0"
vscode-languageserver-protocol-foldingprovider@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.1.tgz#051d0d9e58d1b79dc4681acd48f21797f5515bfd"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-languageserver-protocol "^3.7.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-protocol@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.6.0.tgz#579642cdcccf74b0cd771c33daa3239acb40d040"
vscode-languageserver-protocol@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.7.2.tgz#df58621c032139010888b6a9ddc969423f9ba9d6"
dependencies:
vscode-jsonrpc "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-jsonrpc "^3.6.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-types@^3.6.0:
version "3.6.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.1.tgz#4bc06a48dff653495f12f94b8b1e228988a1748d"
vscode-languageserver-types@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.7.2.tgz#aad8846f8e3e27962648554de5a8417e358f34eb"
vscode-nls@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.1.tgz#b1f3e04e8a94a715d5a7bcbc8339c51e6d74ca51"
vscode-nls@^3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.2.tgz#3817eca5b985c2393de325197cf4e15eb2aa5350"

View file

@ -8,7 +8,7 @@ import { Node, HtmlNode, Rule, Property, Stylesheet } from 'EmmetNode';
import { getEmmetHelper, getNode, getInnerRange, getMappingForIncludedLanguages, parseDocument, validate, getEmmetConfiguration, isStyleSheet, getEmmetMode, parsePartialStylesheet, isStyleAttribute, getEmbeddedCssNodeIfAny } from './util';
const trimRegex = /[\u00a0]*[\d|#|\-|\*|\u2022]+\.?/;
const hexColorRegex = /^#\d+$/;
const hexColorRegex = /^#[\d,a-f,A-F]{0,6}$/;
const allowedMimeTypesInScriptTag = ['text/html', 'text/plain', 'text/x-template', 'text/template'];
const inlineElements = ['a', 'abbr', 'acronym', 'applet', 'b', 'basefont', 'bdo',
'big', 'br', 'button', 'cite', 'code', 'del', 'dfn', 'em', 'font', 'i',
@ -402,6 +402,9 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen
&& abbreviation.indexOf(':') === -1) {
return hexColorRegex.test(abbreviation) || abbreviation === '!';
}
if (hexColorRegex.test(abbreviation) || abbreviation === '!') {
return false;
}
}
// If current node is a rule or at-rule, then perform additional checks to ensure

View file

@ -7,6 +7,10 @@ import * as vscode from 'vscode';
import { HtmlNode } from 'EmmetNode';
import { getNode, parseDocument, validate } from './util';
let balanceOutStack: Array<vscode.Selection[]> = [];
let lastOut = false;
let lastBalancedSelections: vscode.Selection[] = [];
export function balanceOut() {
balance(true);
}
@ -32,8 +36,28 @@ function balance(out: boolean) {
newSelections.push(range);
});
editor.selection = newSelections[0];
editor.selections = newSelections;
if (areSameSelections(newSelections, editor.selections)) {
return;
}
if (areSameSelections(lastBalancedSelections, editor.selections)) {
if (out) {
if (!balanceOutStack.length) {
balanceOutStack.push(editor.selections);
}
balanceOutStack.push(newSelections);
} else {
if (lastOut) {
balanceOutStack.pop();
}
newSelections = balanceOutStack.pop() || newSelections;
}
} else {
balanceOutStack = out ? [editor.selections, newSelections] : [];
}
lastOut = out;
lastBalancedSelections = editor.selections = newSelections;
}
function getRangeToBalanceOut(document: vscode.TextDocument, selection: vscode.Selection, rootNode: HtmlNode): vscode.Selection {
@ -83,3 +107,14 @@ function getRangeToBalanceIn(document: vscode.TextDocument, selection: vscode.Se
}
function areSameSelections(a: vscode.Selection[], b: vscode.Selection[]): boolean {
if (a.length !== b.length) {
return false;
}
for (let i = 0; i < a.length; i++) {
if (!a[i].isEqual(b[i])) {
return false;
}
}
return true;
}

View file

@ -310,6 +310,28 @@ nav#
});
});
test('# shouldnt expand to hex color when in selector (CSS)', () => {
const testContent = `
.foo {
#
}
`;
return withRandomFileEditor(testContent, 'css', (editor, doc) => {
editor.selection = new Selection(2, 2, 2, 2);
return expandEmmetAbbreviation(null).then(() => {
assert.equal(editor.document.getText(), testContent);
const cancelSrc = new CancellationTokenSource();
const completionPromise = completionProvider.provideCompletionItems(editor.document, new Position(2, 2), cancelSrc.token, { triggerKind: CompletionTriggerKind.Invoke });
if (completionPromise) {
assert.equal(1, 2, `Invalid completion of hex color at property name`);
}
return Promise.resolve();
});
});
});
test('Expand abbreviation in completion list (CSS)', () => {
const abbreviation = 'pos:f';
const expandedText = 'position: fixed;';

View file

@ -211,6 +211,35 @@ suite('Tests for Next/Previous Select/Edit point and Balance actions', () => {
});
});
test('Emmet Balance In using the same stack as Balance out in html file', function (): any {
return withRandomFileEditor(htmlContents, 'html', (editor, doc) => {
editor.selections = [new Selection(15, 6, 15, 10)];
let expectedBalanceOutRanges: [number, number, number, number][] = [
[15, 3, 15, 32], // <li class="item1">Item 2</li>
[13, 23, 16, 2], // inner contents of <ul class="nav main">
[13, 2, 16, 7], // outer contents of <ul class="nav main">
[12, 21, 17, 1], // inner contents of <div class="header">
[12, 1, 17, 7], // outer contents of <div class="header">
[8, 6, 18, 0], // inner contents of <body>
[8, 0, 18, 7], // outer contents of <body>
[2, 16, 19, 0], // inner contents of <html>
[2, 0, 19, 7], // outer contents of <html>
];
expectedBalanceOutRanges.forEach(([linestart, colstart, lineend, colend]) => {
balanceOut();
testSelection(editor.selection, colstart, linestart, colend, lineend);
});
expectedBalanceOutRanges.reverse().forEach(([linestart, colstart, lineend, colend]) => {
testSelection(editor.selection, colstart, linestart, colend, lineend);
balanceIn();
});
return Promise.resolve();
});
});
});
function testSelection(selection: Selection, startChar: number, startline: number, endChar?: number, endLine?: number) {

View file

@ -56,7 +56,7 @@ p {
const sassContents = `
.foo
// .foo { brs
/* .foo { op.3
/* .foo { op.3
dn {
*/
@
@ -80,7 +80,7 @@ dn {
test('Block comment between selector and open brace', function (): any {
const cssContents = `
p
p
/* First line
of a multiline
comment */
@ -197,7 +197,6 @@ p.#{dn} {
return withRandomFileEditor(sassContents, '.scss', (editor, doc) => {
let rangesForEmmet = [
new vscode.Range(2, 1, 2, 4), // p.3 inside a ruleset whose selector uses interpolation
new vscode.Range(3, 1, 3, 2), // # inside ruleset
new vscode.Range(4, 1, 4, 3) // dn inside ruleset after property with variable
];
let rangesNotEmmet = [
@ -206,7 +205,8 @@ p.#{dn} {
new vscode.Range(1, 4, 1, 6), // In dn inside variable in selector
new vscode.Range(3, 7, 3, 8), // r of attr inside variable
new vscode.Range(5, 2, 5, 4), // op after ruleset
new vscode.Range(7, 1, 7, 3) // dn inside ruleset whose selector uses nested interpolation
new vscode.Range(7, 1, 7, 3), // dn inside ruleset whose selector uses nested interpolation
new vscode.Range(3, 1, 3, 2), // # inside ruleset
];
rangesForEmmet.forEach(range => {
assert.equal(isValid(doc, range, 'scss'), true);
@ -230,7 +230,7 @@ om
ment */{
m10
}
.boo{
.boo{
op.3
}
`;
@ -256,5 +256,5 @@ ment */{
});
});
});

View file

@ -0,0 +1,5 @@
{
"comments": {
"lineComment": "#",
}
}

View file

@ -991,6 +991,15 @@
}
},
"colors": [
{
"id": "gitDecoration.addedResourceForeground",
"description": "%colors.added%",
"defaults": {
"light": "#587c0c",
"dark": "#81b88b",
"highContrast": "#1b5225"
}
},
{
"id": "gitDecoration.modifiedResourceForeground",
"description": "%colors.modified%",
@ -1082,6 +1091,17 @@
".rej"
],
"configuration": "./languages/diff.language-configuration.json"
},
{
"id": "ignore",
"aliases": [
"Ignore",
"ignore"
],
"filenames": [
".gitignore"
],
"configuration": "./languages/ignore.language-configuration.json"
}
],
"grammars": [
@ -1099,6 +1119,11 @@
"language": "diff",
"scopeName": "source.diff",
"path": "./syntaxes/diff.tmLanguage.json"
},
{
"language": "ignore",
"scopeName": "source.ignore",
"path": "./syntaxes/ignore.tmLanguage.json"
}
],
"configurationDefaults": {

View file

@ -70,6 +70,7 @@
"config.showInlineOpenFileAction": "Controls whether to show an inline Open File action in the Git changes view.",
"config.inputValidation": "Controls when to show commit message input validation.",
"config.detectSubmodules": "Controls whether to automatically detect git submodules.",
"colors.added": "Color for added resources.",
"config.detectSubmodulesLimit": "Controls the limit of git submodules detected.",
"colors.modified": "Color for modified resources.",
"colors.deleted": "Color for deleted resources.",

View file

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#C5C5C5" d="M15 4v6h-2.276c.113-.318.187-.653.226-1h1.05v-5h-2v-2h-4v2.051c-.347.038-.681.112-1 .225v-3.276h5l3 3zm-7 8.949v1.051h-6v-7h2.276c.126-.354.28-.693.485-1h-3.761v9h8v-2.051c-.166.02-.329.051-.5.051l-.5-.051z"/><path fill="#75BEFF" d="M12 8.5c0-1.933-1.567-3.5-3.5-3.5s-3.5 1.567-3.5 3.5 1.567 3.5 3.5 3.5c.711 0 1.369-.215 1.922-.578l3.578 3.578 1-1-3.578-3.578c.363-.553.578-1.211.578-1.922zm-3.5 2.5c-1.381 0-2.5-1.119-2.5-2.5s1.119-2.5 2.5-2.5 2.5 1.119 2.5 2.5-1.119 2.5-2.5 2.5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#252526;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#c5c5c5;}.icon-vs-action-blue{fill:#75beff;}</style></defs><title>Compare_16x</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M16,11H12.121l1.939,1.94a1.5,1.5,0,1,1-2.12,2.12L9.433,12.554A4.4,4.4,0,0,1,9,12.735V16H0V5H4.706A4.445,4.445,0,0,1,7,4.051V0h5.621L16,3.379Z" style="display: none;"/></g><g id="iconBg"><path class="icon-vs-bg" d="M15,3.793V10H11.735a4.4,4.4,0,0,0,.237-1H14V4.207L11.793,2H9V4.276a4.485,4.485,0,0,0-1-.225V1h4.207ZM7,12.949V14H2V7H3.276a4.493,4.493,0,0,1,.486-1H1v9H8V12.972A4.612,4.612,0,0,1,7.5,13,4.342,4.342,0,0,1,7,12.949Z"/></g><g id="colorAction"><path class="icon-vs-action-blue" d="M13.354,13.646l-3-3a.545.545,0,0,0-.071-.047A3.462,3.462,0,0,0,11,8.5,3.5,3.5,0,1,0,7.5,12a3.462,3.462,0,0,0,2.1-.717.57.57,0,0,0,.047.07l3,3a.5.5,0,1,0,.708-.707ZM7.5,11A2.5,2.5,0,1,1,10,8.5,2.5,2.5,0,0,1,7.5,11Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 578 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#656565" d="M15 4v6h-2.276c.113-.318.187-.653.226-1h1.05v-5h-2v-2h-4v2.051c-.347.038-.681.112-1 .225v-3.276h5l3 3zm-7 8.949v1.051h-6v-7h2.276c.126-.354.28-.693.485-1h-3.761v9h8v-2.051c-.166.02-.329.051-.5.051l-.5-.051z"/><path fill="#00539C" d="M12 8.5c0-1.933-1.567-3.5-3.5-3.5s-3.5 1.567-3.5 3.5 1.567 3.5 3.5 3.5c.711 0 1.369-.215 1.922-.578l3.578 3.578 1-1-3.578-3.578c.363-.553.578-1.211.578-1.922zm-3.5 2.5c-1.381 0-2.5-1.119-2.5-2.5s1.119-2.5 2.5-2.5 2.5 1.119 2.5 2.5-1.119 2.5-2.5 2.5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#424242;}.icon-vs-action-blue{fill:#00539c;}</style></defs><title>Compare_16x</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M16,11H12.121l1.939,1.94a1.5,1.5,0,1,1-2.12,2.12L9.433,12.554A4.4,4.4,0,0,1,9,12.735V16H0V5H4.706A4.445,4.445,0,0,1,7,4.051V0h5.621L16,3.379Z" style="display: none;"/></g><g id="iconBg"><path class="icon-vs-bg" d="M15,3.793V10H11.735a4.4,4.4,0,0,0,.237-1H14V4.207L11.793,2H9V4.276a4.485,4.485,0,0,0-1-.225V1h4.207ZM7,12.949V14H2V7H3.276a4.493,4.493,0,0,1,.486-1H1v9H8V12.972A4.612,4.612,0,0,1,7.5,13,4.342,4.342,0,0,1,7,12.949Z"/></g><g id="colorAction"><path class="icon-vs-action-blue" d="M13.354,13.646l-3-3a.545.545,0,0,0-.071-.047A3.462,3.462,0,0,0,11,8.5,3.5,3.5,0,1,0,7.5,12a3.462,3.462,0,0,0,2.1-.717.57.57,0,0,0,.047.07l3,3a.5.5,0,1,0,.708-.707ZM7.5,11A2.5,2.5,0,1,1,10,8.5,2.5,2.5,0,0,1,7.5,11Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 578 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -10,7 +10,7 @@ import { Ref, RefType, Git, GitErrorCodes, Branch } from './git';
import { Repository, Resource, Status, CommitOptions, ResourceGroupType } from './repository';
import { Model } from './model';
import { toGitUri, fromGitUri } from './uri';
import { grep, isDescendant } from './util';
import { grep, isDescendant, pathEquals } from './util';
import { applyLineChanges, intersectDiffWithRange, toLineRanges, invertLineChange, getModifiedRange } from './staging';
import * as path from 'path';
import { lstat, Stats } from 'fs';
@ -612,6 +612,8 @@ export class CommandCenter {
@command('git.stage')
async stage(...resourceStates: SourceControlResourceState[]): Promise<void> {
resourceStates = resourceStates.filter(s => !!s);
if (resourceStates.length === 0 || (resourceStates[0] && !(resourceStates[0].resourceUri instanceof Uri))) {
const resource = this.getSCMResource();
@ -786,6 +788,8 @@ export class CommandCenter {
@command('git.unstage')
async unstage(...resourceStates: SourceControlResourceState[]): Promise<void> {
resourceStates = resourceStates.filter(s => !!s);
if (resourceStates.length === 0 || (resourceStates[0] && !(resourceStates[0].resourceUri instanceof Uri))) {
const resource = this.getSCMResource();
@ -852,6 +856,8 @@ export class CommandCenter {
@command('git.clean')
async clean(...resourceStates: SourceControlResourceState[]): Promise<void> {
resourceStates = resourceStates.filter(s => !!s);
if (resourceStates.length === 0 || (resourceStates[0] && !(resourceStates[0].resourceUri instanceof Uri))) {
const resource = this.getSCMResource();
@ -1325,7 +1331,7 @@ export class CommandCenter {
return;
}
const remotePicks = remotes.map(r => ({ label: r.name, description: r.url }));
const remotePicks = remotes.filter(r => r.fetchUrl !== undefined).map(r => ({ label: r.name, description: r.fetchUrl! }));
const placeHolder = localize('pick remote pull repo', "Pick a remote to pull the branch from");
const remotePick = await window.showQuickPick(remotePicks, { placeHolder });
@ -1432,7 +1438,7 @@ export class CommandCenter {
}
const branchName = repository.HEAD.name;
const picks = remotes.map(r => ({ label: r.name, description: r.url }));
const picks = remotes.filter(r => r.pushUrl !== undefined).map(r => ({ label: r.name, description: r.pushUrl! }));
const placeHolder = localize('pick remote', "Pick a remote to publish the branch '{0}' to:", branchName);
const pick = await window.showQuickPick(picks, { placeHolder });
@ -1450,8 +1456,12 @@ export class CommandCenter {
return;
}
const remoteName = HEAD.remote || HEAD.upstream.remote;
const remote = repository.remotes.find(r => r.name === remoteName);
const isReadonly = remote && remote.isReadOnly;
const config = workspace.getConfiguration('git');
const shouldPrompt = config.get<boolean>('confirmSync') === true;
const shouldPrompt = !isReadonly && config.get<boolean>('confirmSync') === true;
if (shouldPrompt) {
const message = localize('sync is unpredictable', "This action will push and pull commits to and from '{0}/{1}'.", HEAD.upstream.remote, HEAD.upstream.name);
@ -1522,6 +1532,8 @@ export class CommandCenter {
@command('git.ignore')
async ignore(...resourceStates: SourceControlResourceState[]): Promise<void> {
resourceStates = resourceStates.filter(s => !!s);
if (resourceStates.length === 0 || (resourceStates[0] && !(resourceStates[0].resourceUri instanceof Uri))) {
const resource = this.getSCMResource();
@ -1737,7 +1749,7 @@ export class CommandCenter {
}
// Could it be a submodule?
if (resource.fsPath === repository.root) {
if (pathEquals(resource.fsPath, repository.root)) {
repository = this.model.getRepositoryForSubmodule(resource) || repository;
}

View file

@ -9,7 +9,7 @@ import { workspace, Uri, Disposable, Event, EventEmitter, window } from 'vscode'
import { debounce, throttle } from './decorators';
import { fromGitUri, toGitUri } from './uri';
import { Model, ModelChangeEvent, OriginalResourceChangeEvent } from './model';
import { filterEvent, eventToPromise, isDescendant } from './util';
import { filterEvent, eventToPromise, isDescendant, pathEquals } from './util';
interface CacheRow {
uri: Uri;
@ -130,7 +130,7 @@ export class GitContentProvider {
const { path } = fromGitUri(row.uri);
const isOpen = workspace.textDocuments
.filter(d => d.uri.scheme === 'file')
.some(d => d.uri.fsPath === path);
.some(d => pathEquals(d.uri.fsPath, path));
if (isOpen || now - row.timestamp < THREE_MINUTES) {
cache[row.uri.toString()] = row;

View file

@ -13,7 +13,7 @@ import * as which from 'which';
import { EventEmitter } from 'events';
import iconv = require('iconv-lite');
import * as filetype from 'file-type';
import { assign, uniqBy, groupBy, denodeify, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent } from './util';
import { assign, groupBy, denodeify, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent } from './util';
import { CancellationToken } from 'vscode';
import { detectEncoding } from './encoding';
@ -33,7 +33,9 @@ export interface IFileStatus {
export interface Remote {
name: string;
url: string;
fetchUrl?: string;
pushUrl?: string;
isReadOnly: boolean;
}
export interface Stash {
@ -1226,14 +1228,34 @@ export class Repository {
async getRemotes(): Promise<Remote[]> {
const result = await this.run(['remote', '--verbose']);
const regex = /^([^\s]+)\s+([^\s]+)\s/;
const rawRemotes = result.stdout.trim().split('\n')
.filter(b => !!b)
.map(line => regex.exec(line) as RegExpExecArray)
.filter(g => !!g)
.map((groups: RegExpExecArray) => ({ name: groups[1], url: groups[2] }));
const lines = result.stdout.trim().split('\n').filter(l => !!l);
const remotes: Remote[] = [];
return uniqBy(rawRemotes, remote => remote.name);
for (const line of lines) {
const parts = line.split(/\s/);
const [name, url, type] = parts;
let remote = remotes.find(r => r.name === name);
if (!remote) {
remote = { name, isReadOnly: false };
remotes.push(remote);
}
if (/fetch/i.test(type)) {
remote.fetchUrl = url;
} else if (/push/i.test(type)) {
remote.pushUrl = url;
} else {
remote.fetchUrl = url;
remote.pushUrl = url;
}
// https://github.com/Microsoft/vscode/issues/45271
remote.isReadOnly = remote.pushUrl === undefined || remote.pushUrl === 'no_push';
}
return remotes;
}
async getBranch(name: string): Promise<Branch> {

View file

@ -217,7 +217,8 @@ export class Resource implements SourceControlResourceState {
case Status.INDEX_DELETED:
case Status.DELETED:
return new ThemeColor('gitDecoration.deletedResourceForeground');
case Status.INDEX_ADDED: // todo@joh - special color?
case Status.INDEX_ADDED:
return new ThemeColor('gitDecoration.addedResourceForeground');
case Status.INDEX_RENAMED: // todo@joh - special color?
case Status.UNTRACKED:
return new ThemeColor('gitDecoration.untrackedResourceForeground');
@ -559,6 +560,13 @@ export class Repository implements Disposable {
return;
}
if (/^\s+$/.test(text)) {
return {
message: localize('commitMessageWhitespacesOnlyWarning', "Current commit message only contains whitespace characters"),
type: SourceControlInputBoxValidationType.Warning
};
}
let start = 0, end;
let match: RegExpExecArray | null;
const regex = /\r?\n/g;
@ -789,23 +797,29 @@ export class Repository implements Disposable {
}
private async _sync(head: Branch, rebase: boolean): Promise<void> {
let remote: string | undefined;
let remoteName: string | undefined;
let pullBranch: string | undefined;
let pushBranch: string | undefined;
if (head.name && head.upstream) {
remote = head.upstream.remote;
remoteName = head.upstream.remote;
pullBranch = `${head.upstream.name}`;
pushBranch = `${head.name}:${head.upstream.name}`;
}
await this.run(Operation.Sync, async () => {
await this.repository.pull(rebase, remote, pullBranch);
await this.repository.pull(rebase, remoteName, pullBranch);
const shouldPush = this.HEAD && typeof this.HEAD.ahead === 'number' ? this.HEAD.ahead > 0 : true;
const remote = this.remotes.find(r => r.name === remoteName);
if (remote && remote.isReadOnly) {
return;
}
const shouldPush = this.HEAD && (typeof this.HEAD.ahead === 'number' ? this.HEAD.ahead > 0 : true);
if (shouldPush) {
await this.repository.push(remote, pushBranch);
await this.repository.push(remoteName, pushBranch);
}
});
}
@ -1150,6 +1164,13 @@ export class Repository implements Disposable {
return '';
}
const remoteName = this.HEAD && this.HEAD.remote || this.HEAD.upstream.remote;
const remote = this.remotes.find(r => r.name === remoteName);
if (remote && remote.isReadOnly) {
return `${this.HEAD.behind}`;
}
return `${this.HEAD.behind}${this.HEAD.ahead}`;
}

View file

@ -324,3 +324,13 @@ export function isDescendant(parent: string, descendant: string): boolean {
return descendant.startsWith(parent);
}
export function pathEquals(a: string, b: string): boolean {
// Windows is case insensitive
if (isWindowsPath(a)) {
a = a.toLowerCase();
b = b.toLowerCase();
}
return a === b;
}

View file

@ -0,0 +1,10 @@
{
"name": "Ignore",
"scopeName": "source.ignore",
"patterns": [
{
"match": "^#.*",
"name": "comment.line.number-sign.ignore"
}
]
}

View file

@ -187,7 +187,7 @@ export function activate(context: ExtensionContext) {
}
return void 0;
}
return languages.registerFoldingRangeProvider(documentSelector, {
return languages.registerFoldingRangeProvider('html', {
provideFoldingRanges(document: TextDocument, context: FoldingContext, token: CancellationToken) {
const param: FoldingRangeRequestParam = {
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document)

View file

@ -173,8 +173,8 @@
},
"dependencies": {
"vscode-extension-telemetry": "0.0.17",
"vscode-languageclient": "^4.0.0",
"vscode-languageserver-protocol-foldingprovider": "^2.0.0-next.2",
"vscode-languageclient": "^4.1.4",
"vscode-languageserver-protocol-foldingprovider": "^2.0.1",
"vscode-nls": "^3.2.2"
},
"devDependencies": {

View file

@ -8,11 +8,11 @@
"node": "*"
},
"dependencies": {
"vscode-css-languageservice": "^3.0.9-next.10",
"vscode-html-languageservice": "^2.1.3-next.3",
"vscode-languageserver": "^4.0.0",
"vscode-languageserver-protocol-foldingprovider": "^2.0.0-next.2",
"vscode-languageserver-types": "^3.6.1",
"vscode-css-languageservice": "^3.0.9-next.18",
"vscode-html-languageservice": "^2.1.3-next.5",
"vscode-languageserver": "^4.1.3",
"vscode-languageserver-protocol-foldingprovider": "^2.0.1",
"vscode-languageserver-types": "^3.7.2",
"vscode-nls": "^3.2.2",
"vscode-uri": "^1.0.3"
},

View file

@ -48,7 +48,7 @@ documents.listen(connection);
let workspaceFolders: WorkspaceFolder[] = [];
var languageModes: LanguageModes;
let languageModes: LanguageModes;
let clientSnippetSupport = false;
let clientDynamicRegisterSupport = false;
@ -56,7 +56,7 @@ let scopedSettingsSupport = false;
let workspaceFoldersSupport = false;
let foldingRangeLimit = Number.MAX_VALUE;
var globalSettings: Settings = {};
let globalSettings: Settings = {};
let documentSettings: { [key: string]: Thenable<Settings> } = {};
// remove document settings on close
documents.onDidClose(e => {
@ -67,8 +67,8 @@ function getDocumentSettings(textDocument: TextDocument, needsDocumentSettings:
if (scopedSettingsSupport && needsDocumentSettings()) {
let promise = documentSettings[textDocument.uri];
if (!promise) {
let scopeUri = textDocument.uri;
let configRequestParam: ConfigurationParams = { items: [{ scopeUri, section: 'css' }, { scopeUri, section: 'html' }, { scopeUri, section: 'javascript' }] };
const scopeUri = textDocument.uri;
const configRequestParam: ConfigurationParams = { items: [{ scopeUri, section: 'css' }, { scopeUri, section: 'html' }, { scopeUri, section: 'javascript' }] };
promise = connection.sendRequest(ConfigurationRequest.type, configRequestParam).then(s => ({ css: s[0], html: s[1], javascript: s[2] }));
documentSettings[textDocument.uri] = promise;
}
@ -80,7 +80,7 @@ function getDocumentSettings(textDocument: TextDocument, needsDocumentSettings:
// After the server has started the client sends an initialize request. The server receives
// in the passed params the rootPath of the workspace plus the client capabilities
connection.onInitialize((params: InitializeParams): InitializeResult => {
let initializationOptions = params.initializationOptions;
const initializationOptions = params.initializationOptions;
workspaceFolders = (<any>params).workspaceFolders;
if (!Array.isArray(workspaceFolders)) {
@ -103,7 +103,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
});
function getClientCapability<T>(name: string, def: T) {
let keys = name.split('.');
const keys = name.split('.');
let c: any = params.capabilities;
for (let i = 0; c && i < keys.length; i++) {
if (!c.hasOwnProperty(keys[i])) {
@ -119,7 +119,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
scopedSettingsSupport = getClientCapability('workspace.configuration', false);
workspaceFoldersSupport = getClientCapability('workspace.workspaceFolders', false);
foldingRangeLimit = getClientCapability('textDocument.foldingRange.rangeLimit', Number.MAX_VALUE);
let capabilities: ServerCapabilities & FoldingRangeServerCapabilities = {
const capabilities: ServerCapabilities & FoldingRangeServerCapabilities = {
// Tell the client that the server works in FULL text document sync mode
textDocumentSync: documents.syncKind,
completionProvider: clientSnippetSupport ? { resolveProvider: true, triggerCharacters: ['.', ':', '<', '"', '=', '/'] } : undefined,
@ -142,11 +142,11 @@ connection.onInitialized((p) => {
connection.client.register(DidChangeWorkspaceFoldersNotification.type);
connection.onNotification(DidChangeWorkspaceFoldersNotification.type, e => {
let toAdd = e.event.added;
let toRemove = e.event.removed;
let updatedFolders = [];
const toAdd = e.event.added;
const toRemove = e.event.removed;
const updatedFolders = [];
if (workspaceFolders) {
for (let folder of workspaceFolders) {
for (const folder of workspaceFolders) {
if (!toRemove.some(r => r.uri === folder.uri) && !toAdd.some(r => r.uri === folder.uri)) {
updatedFolders.push(folder);
}
@ -168,10 +168,10 @@ connection.onDidChangeConfiguration((change) => {
// dynamically enable & disable the formatter
if (clientDynamicRegisterSupport) {
let enableFormatter = globalSettings && globalSettings.html && globalSettings.html.format && globalSettings.html.format.enable;
const enableFormatter = globalSettings && globalSettings.html && globalSettings.html.format && globalSettings.html.format.enable;
if (enableFormatter) {
if (!formatterRegistration) {
let documentSelector: DocumentSelector = [{ language: 'html' }, { language: 'handlebars' }]; // don't register razor, the formatter does more harm than good
const documentSelector: DocumentSelector = [{ language: 'html' }, { language: 'handlebars' }]; // don't register razor, the formatter does more harm than good
formatterRegistration = connection.client.register(DocumentRangeFormattingRequest.type, { documentSelector });
}
} else if (formatterRegistration) {
@ -197,7 +197,7 @@ documents.onDidClose(event => {
});
function cleanPendingValidation(textDocument: TextDocument): void {
let request = pendingValidationRequests[textDocument.uri];
const request = pendingValidationRequests[textDocument.uri];
if (request) {
clearTimeout(request);
delete pendingValidationRequests[textDocument.uri];
@ -213,7 +213,7 @@ function triggerValidation(textDocument: TextDocument): void {
}
function isValidationEnabled(languageId: string, settings: Settings = globalSettings) {
let validationSettings = settings && settings.html && settings.html.validate;
const validationSettings = settings && settings.html && settings.html.validate;
if (validationSettings) {
return languageId === 'css' && validationSettings.styles !== false || languageId === 'javascript' && validationSettings.scripts !== false;
}
@ -222,19 +222,19 @@ function isValidationEnabled(languageId: string, settings: Settings = globalSett
async function validateTextDocument(textDocument: TextDocument) {
try {
let version = textDocument.version;
let diagnostics: Diagnostic[] = [];
const version = textDocument.version;
const diagnostics: Diagnostic[] = [];
if (textDocument.languageId === 'html') {
let modes = languageModes.getAllModesInDocument(textDocument);
let settings = await getDocumentSettings(textDocument, () => modes.some(m => !!m.doValidation));
textDocument = documents.get(textDocument.uri);
if (textDocument && textDocument.version === version) { // check no new version has come in after in after the async op
const modes = languageModes.getAllModesInDocument(textDocument);
const settings = await getDocumentSettings(textDocument, () => modes.some(m => !!m.doValidation));
const latestTextDocument = documents.get(textDocument.uri);
if (latestTextDocument && latestTextDocument.version === version) { // check no new version has come in after in after the async op
modes.forEach(mode => {
if (mode.doValidation && isValidationEnabled(mode.getId(), settings)) {
pushAll(diagnostics, mode.doValidation(textDocument, settings));
pushAll(diagnostics, mode.doValidation(latestTextDocument, settings));
}
});
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
connection.sendDiagnostics({ uri: latestTextDocument.uri, diagnostics });
}
}
} catch (e) {
@ -245,6 +245,9 @@ async function validateTextDocument(textDocument: TextDocument) {
connection.onCompletion(async (textDocumentPosition, token) => {
return runSafeAsync(async () => {
const document = documents.get(textDocumentPosition.textDocument.uri);
if (!document) {
return null;
}
const mode = languageModes.getModeAtPosition(document, textDocumentPosition.position);
if (!mode || !mode.doComplete) {
return { isIncomplete: true, items: [] };
@ -260,8 +263,8 @@ connection.onCompletion(async (textDocumentPosition, token) => {
connection.telemetry.logEvent({ key: 'html.embbedded.complete', value: { languageId: mode.getId() } });
}
let settings = await getDocumentSettings(document, () => doComplete.length > 2);
let result = doComplete(document, textDocumentPosition.position, settings);
const settings = await getDocumentSettings(document, () => doComplete.length > 2);
const result = doComplete(document, textDocumentPosition.position, settings);
return result;
}, null, `Error while computing completions for ${textDocumentPosition.textDocument.uri}`, token);
@ -269,10 +272,10 @@ connection.onCompletion(async (textDocumentPosition, token) => {
connection.onCompletionResolve((item, token) => {
return runSafe(() => {
let data = item.data;
const data = item.data;
if (data && data.languageId && data.uri) {
let mode = languageModes.getMode(data.languageId);
let document = documents.get(data.uri);
const mode = languageModes.getMode(data.languageId);
const document = documents.get(data.uri);
if (mode && mode.doResolve && document) {
return mode.doResolve(document, item);
}
@ -283,10 +286,12 @@ connection.onCompletionResolve((item, token) => {
connection.onHover((textDocumentPosition, token) => {
return runSafe(() => {
let document = documents.get(textDocumentPosition.textDocument.uri);
let mode = languageModes.getModeAtPosition(document, textDocumentPosition.position);
if (mode && mode.doHover) {
return mode.doHover(document, textDocumentPosition.position);
const document = documents.get(textDocumentPosition.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, textDocumentPosition.position);
if (mode && mode.doHover) {
return mode.doHover(document, textDocumentPosition.position);
}
}
return null;
}, null, `Error while computing hover for ${textDocumentPosition.textDocument.uri}`, token);
@ -294,10 +299,12 @@ connection.onHover((textDocumentPosition, token) => {
connection.onDocumentHighlight((documentHighlightParams, token) => {
return runSafe(() => {
let document = documents.get(documentHighlightParams.textDocument.uri);
let mode = languageModes.getModeAtPosition(document, documentHighlightParams.position);
if (mode && mode.findDocumentHighlight) {
return mode.findDocumentHighlight(document, documentHighlightParams.position);
const document = documents.get(documentHighlightParams.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, documentHighlightParams.position);
if (mode && mode.findDocumentHighlight) {
return mode.findDocumentHighlight(document, documentHighlightParams.position);
}
}
return [];
}, [], `Error while computing document highlights for ${documentHighlightParams.textDocument.uri}`, token);
@ -305,10 +312,12 @@ connection.onDocumentHighlight((documentHighlightParams, token) => {
connection.onDefinition((definitionParams, token) => {
return runSafe(() => {
let document = documents.get(definitionParams.textDocument.uri);
let mode = languageModes.getModeAtPosition(document, definitionParams.position);
if (mode && mode.findDefinition) {
return mode.findDefinition(document, definitionParams.position);
const document = documents.get(definitionParams.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, definitionParams.position);
if (mode && mode.findDefinition) {
return mode.findDefinition(document, definitionParams.position);
}
}
return [];
}, null, `Error while computing definitions for ${definitionParams.textDocument.uri}`, token);
@ -316,10 +325,12 @@ connection.onDefinition((definitionParams, token) => {
connection.onReferences((referenceParams, token) => {
return runSafe(() => {
let document = documents.get(referenceParams.textDocument.uri);
let mode = languageModes.getModeAtPosition(document, referenceParams.position);
if (mode && mode.findReferences) {
return mode.findReferences(document, referenceParams.position);
const document = documents.get(referenceParams.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, referenceParams.position);
if (mode && mode.findReferences) {
return mode.findReferences(document, referenceParams.position);
}
}
return [];
}, [], `Error while computing references for ${referenceParams.textDocument.uri}`, token);
@ -327,10 +338,12 @@ connection.onReferences((referenceParams, token) => {
connection.onSignatureHelp((signatureHelpParms, token) => {
return runSafe(() => {
let document = documents.get(signatureHelpParms.textDocument.uri);
let mode = languageModes.getModeAtPosition(document, signatureHelpParms.position);
if (mode && mode.doSignatureHelp) {
return mode.doSignatureHelp(document, signatureHelpParms.position);
const document = documents.get(signatureHelpParms.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, signatureHelpParms.position);
if (mode && mode.doSignatureHelp) {
return mode.doSignatureHelp(document, signatureHelpParms.position);
}
}
return null;
}, null, `Error while computing signature help for ${signatureHelpParms.textDocument.uri}`, token);
@ -338,24 +351,27 @@ connection.onSignatureHelp((signatureHelpParms, token) => {
connection.onDocumentRangeFormatting(async (formatParams, token) => {
return runSafeAsync(async () => {
let document = documents.get(formatParams.textDocument.uri);
let settings = await getDocumentSettings(document, () => true);
if (!settings) {
settings = globalSettings;
}
let unformattedTags: string = settings && settings.html && settings.html.format && settings.html.format.unformatted || '';
let enabledModes = { css: !unformattedTags.match(/\bstyle\b/), javascript: !unformattedTags.match(/\bscript\b/) };
const document = documents.get(formatParams.textDocument.uri);
if (document) {
let settings = await getDocumentSettings(document, () => true);
if (!settings) {
settings = globalSettings;
}
const unformattedTags: string = settings && settings.html && settings.html.format && settings.html.format.unformatted || '';
const enabledModes = { css: !unformattedTags.match(/\bstyle\b/), javascript: !unformattedTags.match(/\bscript\b/) };
return format(languageModes, document, formatParams.range, formatParams.options, settings, enabledModes);
return format(languageModes, document, formatParams.range, formatParams.options, settings, enabledModes);
}
return [];
}, [], `Error while formatting range for ${formatParams.textDocument.uri}`, token);
});
connection.onDocumentLinks((documentLinkParam, token) => {
return runSafe(() => {
let document = documents.get(documentLinkParam.textDocument.uri);
let links: DocumentLink[] = [];
const document = documents.get(documentLinkParam.textDocument.uri);
const links: DocumentLink[] = [];
if (document) {
let documentContext = getDocumentContext(document.uri, workspaceFolders);
const documentContext = getDocumentContext(document.uri, workspaceFolders);
languageModes.getAllModesInDocument(document).forEach(m => {
if (m.findDocumentLinks) {
pushAll(links, m.findDocumentLinks(document, documentContext));
@ -368,21 +384,23 @@ connection.onDocumentLinks((documentLinkParam, token) => {
connection.onDocumentSymbol((documentSymbolParms, token) => {
return runSafe(() => {
let document = documents.get(documentSymbolParms.textDocument.uri);
let symbols: SymbolInformation[] = [];
languageModes.getAllModesInDocument(document).forEach(m => {
if (m.findDocumentSymbols) {
pushAll(symbols, m.findDocumentSymbols(document));
}
});
const document = documents.get(documentSymbolParms.textDocument.uri);
const symbols: SymbolInformation[] = [];
if (document) {
languageModes.getAllModesInDocument(document).forEach(m => {
if (m.findDocumentSymbols) {
pushAll(symbols, m.findDocumentSymbols(document));
}
});
}
return symbols;
}, [], `Error while computing document symbols for ${documentSymbolParms.textDocument.uri}`, token);
});
connection.onRequest(DocumentColorRequest.type, (params, token) => {
return runSafe(() => {
let infos: ColorInformation[] = [];
let document = documents.get(params.textDocument.uri);
const infos: ColorInformation[] = [];
const document = documents.get(params.textDocument.uri);
if (document) {
languageModes.getAllModesInDocument(document).forEach(m => {
if (m.findDocumentColors) {
@ -396,9 +414,9 @@ connection.onRequest(DocumentColorRequest.type, (params, token) => {
connection.onRequest(ColorPresentationRequest.type, (params, token) => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
const document = documents.get(params.textDocument.uri);
if (document) {
let mode = languageModes.getModeAtPosition(document, params.range.start);
const mode = languageModes.getModeAtPosition(document, params.range.start);
if (mode && mode.getColorPresentations) {
return mode.getColorPresentations(document, params.color, params.range);
}
@ -409,11 +427,11 @@ connection.onRequest(ColorPresentationRequest.type, (params, token) => {
connection.onRequest(TagCloseRequest.type, (params, token) => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
const document = documents.get(params.textDocument.uri);
if (document) {
let pos = params.position;
const pos = params.position;
if (pos.character > 0) {
let mode = languageModes.getModeAtPosition(document, Position.create(pos.line, pos.character - 1));
const mode = languageModes.getModeAtPosition(document, Position.create(pos.line, pos.character - 1));
if (mode && mode.doAutoClose) {
return mode.doAutoClose(document, pos);
}
@ -425,7 +443,7 @@ connection.onRequest(TagCloseRequest.type, (params, token) => {
connection.onRequest(FoldingRangeRequest.type, (params, token) => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
const document = documents.get(params.textDocument.uri);
if (document) {
return getFoldingRanges(languageModes, document, foldingRangeLimit, token);
}

View file

@ -69,7 +69,7 @@ export function getJavaScriptMode(documentRegions: LanguageModelCache<HTMLDocume
},
doValidation(document: TextDocument): Diagnostic[] {
updateCurrentTextDocument(document);
const syntaxDiagnostics = jsLanguageService.getSyntacticDiagnostics(FILE_NAME);
const syntaxDiagnostics: ts.Diagnostic[] = jsLanguageService.getSyntacticDiagnostics(FILE_NAME);
const semanticDiagnostics = jsLanguageService.getSemanticDiagnostics(FILE_NAME);
return syntaxDiagnostics.concat(semanticDiagnostics).map((diag: ts.Diagnostic): Diagnostic => {
return {

View file

@ -10,54 +10,50 @@
version "7.0.43"
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.43.tgz#a187e08495a075f200ca946079c914e1a5fe962c"
vscode-css-languageservice@^3.0.9-next.10:
version "3.0.9-next.10"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-3.0.9-next.10.tgz#be73d571221176b43d2c398a4a27f7d38206952d"
vscode-css-languageservice@^3.0.9-next.18:
version "3.0.9-next.18"
resolved "https://registry.yarnpkg.com/vscode-css-languageservice/-/vscode-css-languageservice-3.0.9-next.18.tgz#f8f25123b5a8cdc9f72fafcd2c0088f726322437"
dependencies:
vscode-languageserver-types "^3.6.1"
vscode-nls "^3.2.1"
vscode-languageserver-types "^3.7.2"
vscode-nls "^3.2.2"
vscode-html-languageservice@^2.1.3-next.3:
version "2.1.3-next.3"
resolved "https://registry.yarnpkg.com/vscode-html-languageservice/-/vscode-html-languageservice-2.1.3-next.3.tgz#20c4a0ae673815b598a7e132b5ef03a6920fa7af"
vscode-html-languageservice@^2.1.3-next.5:
version "2.1.3-next.5"
resolved "https://registry.yarnpkg.com/vscode-html-languageservice/-/vscode-html-languageservice-2.1.3-next.5.tgz#cfbf4ffed96845ad13999d572ce0b5c2aeee84af"
dependencies:
vscode-languageserver-types "^3.6.1"
vscode-nls "^3.2.1"
vscode-languageserver-types "^3.7.2"
vscode-nls "^3.2.2"
vscode-uri "^1.0.3"
vscode-jsonrpc@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0.tgz#848d56995d5168950d84feb5d9c237ae5c6a02d4"
vscode-jsonrpc@^3.6.2:
version "3.6.2"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.2.tgz#3b5eef691159a15556ecc500e9a8a0dd143470c8"
vscode-languageserver-protocol-foldingprovider@^2.0.0-next.2:
version "2.0.0-next.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.0-next.2.tgz#fbb9cfdf5b8c4ac451826ba6312f1f88379f35b0"
vscode-languageserver-protocol-foldingprovider@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.1.tgz#051d0d9e58d1b79dc4681acd48f21797f5515bfd"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-languageserver-protocol "^3.7.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-protocol@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.6.0.tgz#579642cdcccf74b0cd771c33daa3239acb40d040"
vscode-languageserver-protocol@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.7.2.tgz#df58621c032139010888b6a9ddc969423f9ba9d6"
dependencies:
vscode-jsonrpc "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-jsonrpc "^3.6.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-types@^3.6.0, vscode-languageserver-types@^3.6.1:
version "3.6.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.1.tgz#4bc06a48dff653495f12f94b8b1e228988a1748d"
vscode-languageserver-types@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.7.2.tgz#aad8846f8e3e27962648554de5a8417e358f34eb"
vscode-languageserver@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-4.0.0.tgz#8b792f0d6d10acfe363d02371ed4ce53d08af88a"
vscode-languageserver@^4.1.3:
version "4.1.3"
resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-4.1.3.tgz#937d37c955b6b9c2409388413cd6f54d1eb9fe7d"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-protocol "^3.7.2"
vscode-uri "^1.0.1"
vscode-nls@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.1.tgz#b1f3e04e8a94a715d5a7bcbc8339c51e6d74ca51"
vscode-nls@^3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.2.tgz#3817eca5b985c2393de325197cf4e15eb2aa5350"

View file

@ -34,33 +34,33 @@ vscode-extension-telemetry@0.0.17:
dependencies:
applicationinsights "1.0.1"
vscode-jsonrpc@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0.tgz#848d56995d5168950d84feb5d9c237ae5c6a02d4"
vscode-jsonrpc@^3.6.2:
version "3.6.2"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.2.tgz#3b5eef691159a15556ecc500e9a8a0dd143470c8"
vscode-languageclient@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.0.0.tgz#635f5bfbcfa1385dae489b394857f1db8b459a7d"
vscode-languageclient@^4.1.4:
version "4.1.4"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.1.4.tgz#fff1a6bca4714835dca7fce35bc4ce81442fdf2c"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-protocol "^3.7.2"
vscode-languageserver-protocol-foldingprovider@^2.0.0-next.2:
version "2.0.0-next.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.0-next.2.tgz#fbb9cfdf5b8c4ac451826ba6312f1f88379f35b0"
vscode-languageserver-protocol-foldingprovider@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.1.tgz#051d0d9e58d1b79dc4681acd48f21797f5515bfd"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-languageserver-protocol "^3.7.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-protocol@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.6.0.tgz#579642cdcccf74b0cd771c33daa3239acb40d040"
vscode-languageserver-protocol@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.7.2.tgz#df58621c032139010888b6a9ddc969423f9ba9d6"
dependencies:
vscode-jsonrpc "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-jsonrpc "^3.6.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-types@^3.6.0:
version "3.6.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.1.tgz#4bc06a48dff653495f12f94b8b1e228988a1748d"
vscode-languageserver-types@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.7.2.tgz#aad8846f8e3e27962648554de5a8417e358f34eb"
vscode-nls@^3.2.2:
version "3.2.2"

View file

@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/bccefcd3facfca34c7821801692472ac1fce61d6",
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/2165b3e1139e13880d450ba1bae0801df32b1a01",
"name": "JavaScript (with React support)",
"scopeName": "source.js",
"patterns": [
@ -48,6 +48,9 @@
{
"include": "#decl-block"
},
{
"include": "#label"
},
{
"include": "#expression"
},
@ -135,6 +138,38 @@
}
]
},
"label": {
"patterns": [
{
"begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(:)(?=\\s*\\{)",
"beginCaptures": {
"1": {
"name": "entity.name.label.js"
},
"2": {
"name": "punctuation.separator.label.js"
}
},
"end": "(?<=\\{)",
"patterns": [
{
"include": "#decl-block"
}
]
},
{
"match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(:)",
"captures": {
"1": {
"name": "entity.name.label.js"
},
"2": {
"name": "punctuation.separator.label.js"
}
}
}
]
},
"expression": {
"patterns": [
{
@ -1390,9 +1425,6 @@
}
},
"patterns": [
{
"include": "#string"
},
{
"include": "#comment"
},
@ -1408,6 +1440,9 @@
{
"include": "#field-declaration"
},
{
"include": "#string"
},
{
"include": "#type-annotation"
},

View file

@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/bccefcd3facfca34c7821801692472ac1fce61d6",
"version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/2165b3e1139e13880d450ba1bae0801df32b1a01",
"name": "JavaScript (with React support)",
"scopeName": "source.js.jsx",
"patterns": [
@ -48,6 +48,9 @@
{
"include": "#decl-block"
},
{
"include": "#label"
},
{
"include": "#expression"
},
@ -135,6 +138,38 @@
}
]
},
"label": {
"patterns": [
{
"begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(:)(?=\\s*\\{)",
"beginCaptures": {
"1": {
"name": "entity.name.label.js.jsx"
},
"2": {
"name": "punctuation.separator.label.js.jsx"
}
},
"end": "(?<=\\{)",
"patterns": [
{
"include": "#decl-block"
}
]
},
{
"match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(:)",
"captures": {
"1": {
"name": "entity.name.label.js.jsx"
},
"2": {
"name": "punctuation.separator.label.js.jsx"
}
}
}
]
},
"expression": {
"patterns": [
{
@ -1390,9 +1425,6 @@
}
},
"patterns": [
{
"include": "#string"
},
{
"include": "#comment"
},
@ -1408,6 +1440,9 @@
{
"include": "#field-declaration"
},
{
"include": "#string"
},
{
"include": "#type-annotation"
},

View file

@ -101,8 +101,8 @@
},
"dependencies": {
"vscode-extension-telemetry": "0.0.17",
"vscode-languageclient": "^4.0.0",
"vscode-languageserver-protocol-foldingprovider": "^2.0.0-next.2",
"vscode-languageclient": "^4.1.4",
"vscode-languageserver-protocol-foldingprovider": "^2.0.1",
"vscode-nls": "^3.2.2"
},
"devDependencies": {

View file

@ -13,9 +13,9 @@
"dependencies": {
"jsonc-parser": "^2.0.0-next.1",
"request-light": "^0.2.2",
"vscode-json-languageservice": "^3.1.2-next.2",
"vscode-languageserver": "^4.0.0",
"vscode-languageserver-protocol-foldingprovider": "^2.0.0-next.2",
"vscode-json-languageservice": "^3.1.2-next.3",
"vscode-languageserver": "^4.1.3",
"vscode-languageserver-protocol-foldingprovider": "^2.0.1",
"vscode-nls": "^3.2.2",
"vscode-uri": "^1.0.3"
},

View file

@ -38,7 +38,7 @@ namespace SchemaContentChangeNotification {
}
// Create a connection for the server
let connection: IConnection = createConnection();
const connection: IConnection = createConnection();
process.on('unhandledRejection', (e: any) => {
console.error(formatError(`Unhandled exception`, e));
@ -53,7 +53,7 @@ console.error = connection.console.error.bind(connection.console);
// Create a simple text document manager. The text document manager
// supports full document sync only
let documents: TextDocuments = new TextDocuments();
const documents: TextDocuments = new TextDocuments();
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);
@ -67,7 +67,7 @@ let foldingRangeLimit = Number.MAX_VALUE;
connection.onInitialize((params: InitializeParams): InitializeResult => {
function getClientCapability<T>(name: string, def: T) {
let keys = name.split('.');
const keys = name.split('.');
let c: any = params.capabilities;
for (let i = 0; c && i < keys.length; i++) {
if (!c.hasOwnProperty(keys[i])) {
@ -81,7 +81,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
clientSnippetSupport = getClientCapability('textDocument.completion.completionItem.snippetSupport', false);
clientDynamicRegisterSupport = getClientCapability('workspace.symbol.dynamicRegistration', false);
foldingRangeLimit = getClientCapability('textDocument.foldingRange.rangeLimit', Number.MAX_VALUE);
let capabilities: ServerCapabilities & FoldingRangeServerCapabilities = {
const capabilities: ServerCapabilities & FoldingRangeServerCapabilities = {
// Tell the client that the server works in FULL text document sync mode
textDocumentSync: documents.syncKind,
completionProvider: clientSnippetSupport ? { resolveProvider: true, triggerCharacters: ['"', ':'] } : void 0,
@ -95,15 +95,15 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
return { capabilities };
});
let workspaceContext = {
const workspaceContext = {
resolveRelativePath: (relativePath: string, resource: string) => {
return URL.resolve(resource, relativePath);
}
};
let schemaRequestService = (uri: string): Thenable<string> => {
const schemaRequestService = (uri: string): Thenable<string> => {
if (startsWith(uri, 'file://')) {
let fsPath = URI.parse(uri).fsPath;
const fsPath = URI.parse(uri).fsPath;
return new Promise<string>((c, e) => {
fs.readFile(fsPath, 'UTF-8', (err, result) => {
err ? e('') : c(result.toString());
@ -129,7 +129,7 @@ let schemaRequestService = (uri: string): Thenable<string> => {
}
});
}
let headers = { 'Accept-Encoding': 'gzip, deflate' };
const headers = { 'Accept-Encoding': 'gzip, deflate' };
return xhr({ url: uri, followRedirects: 5, headers }).then(response => {
return response.responseText;
}, (error: XHRResponse) => {
@ -138,7 +138,7 @@ let schemaRequestService = (uri: string): Thenable<string> => {
};
// create the JSON language service
let languageService = getLanguageService({
const languageService = getLanguageService({
schemaRequestService,
workspaceContext,
contributions: []
@ -176,7 +176,7 @@ connection.onDidChangeConfiguration((change) => {
// dynamically enable & disable the formatter
if (clientDynamicRegisterSupport) {
let enableFormatter = settings && settings.json && settings.json.format && settings.json.format.enable;
const enableFormatter = settings && settings.json && settings.json.format && settings.json.format.enable;
if (enableFormatter) {
if (!formatterRegistration) {
formatterRegistration = connection.client.register(DocumentRangeFormattingRequest.type, { documentSelector: [{ language: 'json' }, { language: 'jsonc' }] });
@ -200,14 +200,14 @@ connection.onNotification(SchemaContentChangeNotification.type, uri => {
});
function updateConfiguration() {
let languageSettings = {
const languageSettings = {
validate: true,
allowComments: true,
schemas: new Array<SchemaConfiguration>()
};
if (schemaAssociations) {
for (var pattern in schemaAssociations) {
let association = schemaAssociations[pattern];
const association = schemaAssociations[pattern];
if (Array.isArray(association)) {
association.forEach(uri => {
languageSettings.schemas.push({ uri, fileMatch: [pattern] });
@ -244,11 +244,11 @@ documents.onDidClose(event => {
connection.sendDiagnostics({ uri: event.document.uri, diagnostics: [] });
});
let pendingValidationRequests: { [uri: string]: NodeJS.Timer; } = {};
const pendingValidationRequests: { [uri: string]: NodeJS.Timer; } = {};
const validationDelayMs = 500;
function cleanPendingValidation(textDocument: TextDocument): void {
let request = pendingValidationRequests[textDocument.uri];
const request = pendingValidationRequests[textDocument.uri];
if (request) {
clearTimeout(request);
delete pendingValidationRequests[textDocument.uri];
@ -269,13 +269,13 @@ function validateTextDocument(textDocument: TextDocument): void {
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics: [] });
return;
}
let jsonDocument = getJSONDocument(textDocument);
let version = textDocument.version;
const jsonDocument = getJSONDocument(textDocument);
const version = textDocument.version;
let documentSettings: DocumentLanguageSettings = textDocument.languageId === 'jsonc' ? { comments: 'ignore', trailingCommas: 'ignore' } : { comments: 'error', trailingCommas: 'error' };
const documentSettings: DocumentLanguageSettings = textDocument.languageId === 'jsonc' ? { comments: 'ignore', trailingCommas: 'ignore' } : { comments: 'error', trailingCommas: 'error' };
languageService.doValidation(textDocument, jsonDocument, documentSettings).then(diagnostics => {
setTimeout(() => {
let currDocument = documents.get(textDocument.uri);
const currDocument = documents.get(textDocument.uri);
if (currDocument && currDocument.version === version) {
// Send the computed diagnostics to VSCode.
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics });
@ -299,7 +299,7 @@ connection.onDidChangeWatchedFiles((change) => {
}
});
let jsonDocuments = getLanguageModelCache<JSONDocument>(10, 60, document => languageService.parseJSONDocument(document));
const jsonDocuments = getLanguageModelCache<JSONDocument>(10, 60, document => languageService.parseJSONDocument(document));
documents.onDidClose(e => {
jsonDocuments.onDocumentRemoved(e.document);
});
@ -312,10 +312,13 @@ function getJSONDocument(document: TextDocument): JSONDocument {
}
connection.onCompletion((textDocumentPosition, token) => {
return runSafeAsync(() => {
let document = documents.get(textDocumentPosition.textDocument.uri);
let jsonDocument = getJSONDocument(document);
return languageService.doComplete(document, textDocumentPosition.position, jsonDocument);
return runSafeAsync(async () => {
const document = documents.get(textDocumentPosition.textDocument.uri);
if (document) {
const jsonDocument = getJSONDocument(document);
return languageService.doComplete(document, textDocumentPosition.position, jsonDocument);
}
return null;
}, null, `Error while computing completions for ${textDocumentPosition.textDocument.uri}`, token);
});
@ -326,44 +329,53 @@ connection.onCompletionResolve((completionItem, token) => {
});
connection.onHover((textDocumentPositionParams, token) => {
return runSafeAsync(() => {
let document = documents.get(textDocumentPositionParams.textDocument.uri);
let jsonDocument = getJSONDocument(document);
return languageService.doHover(document, textDocumentPositionParams.position, jsonDocument);
return runSafeAsync(async () => {
const document = documents.get(textDocumentPositionParams.textDocument.uri);
if (document) {
const jsonDocument = getJSONDocument(document);
return languageService.doHover(document, textDocumentPositionParams.position, jsonDocument);
}
return null;
}, null, `Error while computing hover for ${textDocumentPositionParams.textDocument.uri}`, token);
});
connection.onDocumentSymbol((documentSymbolParams, token) => {
return runSafe(() => {
let document = documents.get(documentSymbolParams.textDocument.uri);
let jsonDocument = getJSONDocument(document);
return languageService.findDocumentSymbols(document, jsonDocument);
const document = documents.get(documentSymbolParams.textDocument.uri);
if (document) {
const jsonDocument = getJSONDocument(document);
return languageService.findDocumentSymbols(document, jsonDocument);
}
return [];
}, [], `Error while computing document symbols for ${documentSymbolParams.textDocument.uri}`, token);
});
connection.onDocumentRangeFormatting((formatParams, token) => {
return runSafe(() => {
let document = documents.get(formatParams.textDocument.uri);
return languageService.format(document, formatParams.range, formatParams.options);
const document = documents.get(formatParams.textDocument.uri);
if (document) {
return languageService.format(document, formatParams.range, formatParams.options);
}
return [];
}, [], `Error while formatting range for ${formatParams.textDocument.uri}`, token);
});
connection.onDocumentColor((params, token) => {
return runSafeAsync(() => {
let document = documents.get(params.textDocument.uri);
return runSafeAsync(async () => {
const document = documents.get(params.textDocument.uri);
if (document) {
let jsonDocument = getJSONDocument(document);
const jsonDocument = getJSONDocument(document);
return languageService.findDocumentColors(document, jsonDocument);
}
return Promise.resolve([]);
return [];
}, [], `Error while computing document colors for ${params.textDocument.uri}`, token);
});
connection.onColorPresentation((params, token) => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
const document = documents.get(params.textDocument.uri);
if (document) {
let jsonDocument = getJSONDocument(document);
const jsonDocument = getJSONDocument(document);
return languageService.getColorPresentations(document, jsonDocument, params.color, params.range);
}
return [];
@ -372,7 +384,7 @@ connection.onColorPresentation((params, token) => {
connection.onRequest(FoldingRangeRequest.type, (params, token) => {
return runSafe(() => {
let document = documents.get(params.textDocument.uri);
const document = documents.get(params.textDocument.uri);
if (document) {
return languageService.getFoldingRanges(document, { rangeLimit: foldingRangeLimit });
}

View file

@ -72,56 +72,48 @@ request-light@^0.2.2:
https-proxy-agent "2.1.1"
vscode-nls "^2.0.2"
vscode-json-languageservice@^3.1.2-next.2:
version "3.1.2-next.2"
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.1.2-next.2.tgz#da5346e5c22edbce739f29c110eb41732d41dc2d"
vscode-json-languageservice@^3.1.2-next.3:
version "3.1.2-next.3"
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.1.2-next.3.tgz#cc0902148f898b413987fb1b4c4a9e7fc1a79c78"
dependencies:
jsonc-parser "^2.0.0"
vscode-languageserver-types "^3.6.1"
vscode-nls "^3.2.1"
vscode-languageserver-types "^3.7.2"
vscode-nls "^3.2.2"
vscode-uri "^1.0.3"
vscode-jsonrpc@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0.tgz#848d56995d5168950d84feb5d9c237ae5c6a02d4"
vscode-jsonrpc@^3.6.2:
version "3.6.2"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.2.tgz#3b5eef691159a15556ecc500e9a8a0dd143470c8"
vscode-languageserver-protocol-foldingprovider@^2.0.0-next.2:
version "2.0.0-next.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.0-next.2.tgz#fbb9cfdf5b8c4ac451826ba6312f1f88379f35b0"
vscode-languageserver-protocol-foldingprovider@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.1.tgz#051d0d9e58d1b79dc4681acd48f21797f5515bfd"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-languageserver-protocol "^3.7.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-protocol@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.6.0.tgz#579642cdcccf74b0cd771c33daa3239acb40d040"
vscode-languageserver-protocol@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.7.2.tgz#df58621c032139010888b6a9ddc969423f9ba9d6"
dependencies:
vscode-jsonrpc "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-jsonrpc "^3.6.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-types@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.0.tgz#0bba63b0fa82a714394a4478f55a596ee4ed7d0a"
vscode-languageserver-types@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.7.2.tgz#aad8846f8e3e27962648554de5a8417e358f34eb"
vscode-languageserver-types@^3.6.1:
version "3.6.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.1.tgz#4bc06a48dff653495f12f94b8b1e228988a1748d"
vscode-languageserver@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-4.0.0.tgz#8b792f0d6d10acfe363d02371ed4ce53d08af88a"
vscode-languageserver@^4.1.3:
version "4.1.3"
resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-4.1.3.tgz#937d37c955b6b9c2409388413cd6f54d1eb9fe7d"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-protocol "^3.7.2"
vscode-uri "^1.0.1"
vscode-nls@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-2.0.2.tgz#808522380844b8ad153499af5c3b03921aea02da"
vscode-nls@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.1.tgz#b1f3e04e8a94a715d5a7bcbc8339c51e6d74ca51"
vscode-nls@^3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.2.tgz#3817eca5b985c2393de325197cf4e15eb2aa5350"

View file

@ -34,33 +34,33 @@ vscode-extension-telemetry@0.0.17:
dependencies:
applicationinsights "1.0.1"
vscode-jsonrpc@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.0.tgz#848d56995d5168950d84feb5d9c237ae5c6a02d4"
vscode-jsonrpc@^3.6.2:
version "3.6.2"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-3.6.2.tgz#3b5eef691159a15556ecc500e9a8a0dd143470c8"
vscode-languageclient@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.0.0.tgz#635f5bfbcfa1385dae489b394857f1db8b459a7d"
vscode-languageclient@^4.1.4:
version "4.1.4"
resolved "https://registry.yarnpkg.com/vscode-languageclient/-/vscode-languageclient-4.1.4.tgz#fff1a6bca4714835dca7fce35bc4ce81442fdf2c"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-protocol "^3.7.2"
vscode-languageserver-protocol-foldingprovider@^2.0.0-next.2:
version "2.0.0-next.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.0-next.2.tgz#fbb9cfdf5b8c4ac451826ba6312f1f88379f35b0"
vscode-languageserver-protocol-foldingprovider@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol-foldingprovider/-/vscode-languageserver-protocol-foldingprovider-2.0.1.tgz#051d0d9e58d1b79dc4681acd48f21797f5515bfd"
dependencies:
vscode-languageserver-protocol "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-languageserver-protocol "^3.7.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-protocol@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.6.0.tgz#579642cdcccf74b0cd771c33daa3239acb40d040"
vscode-languageserver-protocol@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.7.2.tgz#df58621c032139010888b6a9ddc969423f9ba9d6"
dependencies:
vscode-jsonrpc "^3.6.0"
vscode-languageserver-types "^3.6.0"
vscode-jsonrpc "^3.6.2"
vscode-languageserver-types "^3.7.2"
vscode-languageserver-types@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.6.0.tgz#0bba63b0fa82a714394a4478f55a596ee4ed7d0a"
vscode-languageserver-types@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.7.2.tgz#aad8846f8e3e27962648554de5a8417e358f34eb"
vscode-nls@^3.2.2:
version "3.2.2"

View file

@ -57,7 +57,7 @@
"meta.embedded.block.dockerfile": "dockerfile",
"meta.embedded.block.go": "go",
"meta.embedded.block.groovy": "groovy",
"meta.embedded.block.jade": "jade",
"meta.embedded.block.pug": "jade",
"meta.embedded.block.javascript": "javascript",
"meta.embedded.block.json": "json",
"meta.embedded.block.less": "less",

View file

@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/e667795f83c83e36dc6f90bde14632a963c52e34",
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/ab08007feb924996eff9399c169f171fa17899ca",
"name": "Markdown",
"scopeName": "text.html.markdown",
"patterns": [
@ -109,7 +109,7 @@
"include": "#fenced_code_block_groovy"
},
{
"include": "#fenced_code_block_jade"
"include": "#fenced_code_block_pug"
},
{
"include": "#fenced_code_block_js"
@ -162,6 +162,9 @@
{
"include": "#fenced_code_block_fsharp"
},
{
"include": "#fenced_code_block_dart"
},
{
"include": "#fenced_code_block_unknown"
},
@ -1055,7 +1058,7 @@
}
]
},
"fenced_code_block_jade": {
"fenced_code_block_pug": {
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(jade|pug)(\\s+[^`~]*)?$)",
"name": "markup.fenced_code.block.markdown",
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
@ -1079,10 +1082,10 @@
{
"begin": "(^|\\G)(\\s*)(.*)",
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
"contentName": "meta.embedded.block.jade",
"contentName": "meta.embedded.block.pug",
"patterns": [
{
"include": "text.jade"
"include": "text.pug"
}
]
}
@ -1649,6 +1652,39 @@
}
]
},
"fenced_code_block_dart": {
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(dart)(\\s+[^`~]*)?$)",
"name": "markup.fenced_code.block.markdown",
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
"beginCaptures": {
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
},
"6": {
"name": "fenced_code.block.language.attributes"
}
},
"endCaptures": {
"3": {
"name": "punctuation.definition.markdown"
}
},
"patterns": [
{
"begin": "(^|\\G)(\\s*)(.*)",
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
"contentName": "meta.embedded.block.dart",
"patterns": [
{
"include": "source.dart"
}
]
}
]
},
"fenced_code_block_unknown": {
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?=([^`~]*)?$)",
"beginCaptures": {

View file

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.st0{fill:#f6f6f6}.st1{fill:none}.st2{fill:#424242}.st3{fill:#f0eff1}</style><path class="st0" d="M11.949 4C11.697 1.756 9.811 0 7.5 0A4.505 4.505 0 0 0 3 4.5c0 .6.12 1.188.35 1.735L0 9.586v.828l2 2 3-2.999V16h11V4h-4.051z" id="outline" style="display: none;"/><g id="icon_x5F_bg"><circle class="st1" cx="7.5" cy="4.5" r="2.5"/><path class="st2" d="M12 10h1v3h-1zM10 11h1v2h-1zM8 12h1v1H8zM8 9h2v1H8z"/><path class="st2" d="M11.949 5a4.431 4.431 0 0 1-.226 1H14v8H7V8.95a4.447 4.447 0 0 1-1-.227V15h9V5h-3.051z"/><path class="st2" d="M10.294 8H12V7h-.762a4.527 4.527 0 0 1-.944 1zM11 4.5a3.5 3.5 0 1 0-7 0c0 .711.215 1.369.579 1.922L1 10l1 1 3.579-3.578A3.485 3.485 0 0 0 7.5 8 3.5 3.5 0 0 0 11 4.5zm-6 0a2.5 2.5 0 1 1 5 0 2.5 2.5 0 0 1-5 0z"/></g><g id="icon_x5F_fg"><path class="st1" d="M10 11h1v2h-1zM8 12h1v1H8zM8 9h2v1H8zM12 10h1v3h-1z"/><path class="st3" d="M11.724 6a4.469 4.469 0 0 1-.485 1H12v1h-1.706c-.771.616-1.733 1-2.794 1-.169 0-.333-.031-.5-.05V14h7V6h-2.276zM8 9h2v1H8V9zm1 4H8v-1h1v1zm2 0h-1v-2h1v2zm2 0h-1v-3h1v3z"/><circle class="st3" cx="7.5" cy="4.5" r="2.5"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#424242;}.icon-vs-action-blue{fill:#00539c;}</style></defs><title>SwitchToPreview_16x</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M16,4V16H5V9.121l-1.939,1.94A1.5,1.5,0,0,1,.939,8.939L3.446,6.433A4.4,4.4,0,0,1,3,4.5,4.488,4.488,0,0,1,11.949,4Z" style="display: none;"/></g><g id="iconBg"><path class="icon-vs-bg" d="M12,10h1v3H12Zm0-3h-.762a4.5,4.5,0,0,1-.944,1H12Zm-2,6h1V11H10Zm2-8h-.051a4.485,4.485,0,0,1-.225,1H14v8H7V8.972a4.4,4.4,0,0,1-1-.237V15h9V5ZM9,12H8v1H9Zm1-3H8v1h2Z"/></g><g id="colorAction"><path class="icon-vs-action-blue" d="M7.5,1A3.5,3.5,0,0,0,4,4.5a3.463,3.463,0,0,0,.707,2.086L1.646,9.646a.5.5,0,0,0,.708.708l3.06-3.061A3.463,3.463,0,0,0,7.5,8a3.5,3.5,0,0,0,0-7Zm0,6A2.5,2.5,0,1,1,10,4.5,2.5,2.5,0,0,1,7.5,7Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -1,19 +1 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.icon_x002D_vs_x002D_bg{fill:#424242;}
</style>
<g id="canvas">
</g>
<g id="outline">
</g>
<g id="iconFg">
</g>
<g id="iconBg">
<path class="icon_x002D_vs_x002D_bg" d="M9,5h5v2.4c0.4,0.2,0.7,0.4,1,0.7V2H1v12h5.6L9,11.6V5z M2,13V5h5v8H2z M11.3,12.7
c0.4,0.2,0.8,0.3,1.2,0.3c1.4,0,2.5-1.1,2.5-2.5C15,9.1,13.9,8,12.5,8C11.1,8,10,9.1,10,10.5c0,0.4,0.1,0.8,0.3,1.2L8,14l1,1
L11.3,12.7z M11,10.5C11,9.7,11.7,9,12.5,9c0.8,0,1.5,0.7,1.5,1.5c0,0.8-0.7,1.5-1.5,1.5C11.7,12,11,11.3,11,10.5z"/>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#f6f6f6;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#424242;}.icon-vs-action-blue{fill:#00539c;}</style></defs><title>PreviewInRightPanel_16x</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M16,1V15H10.121l-.56.561a1.5,1.5,0,0,1-2.122,0A1.469,1.469,0,0,1,7.1,15H0V1Z" style="display: none;"/></g><g id="iconBg"><path class="icon-vs-bg" d="M1,2V14H7.1a1.469,1.469,0,0,1,.341-.561L9,11.88V5h5V7.351a3.515,3.515,0,0,1,1,.707V2ZM7,13H2V5H7Z"/></g><g id="colorAction"><path class="icon-vs-action-blue" d="M12.5,8a2.5,2.5,0,0,0-2.084,3.877l-2.27,2.269a.5.5,0,0,0,.708.708l2.269-2.27A2.5,2.5,0,1,0,12.5,8Zm0,4A1.5,1.5,0,1,1,14,10.5,1.5,1.5,0,0,1,12.5,12Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 889 B

View file

@ -1,19 +1 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
<style type="text/css">
.st0{fill:#C5C5C5;}
</style>
<g id="canvas">
</g>
<g id="outline">
</g>
<g id="iconFg">
</g>
<g id="iconBg">
<path class="st0" d="M9,5h5v2.4c0.4,0.2,0.7,0.4,1,0.7V2H1v12h5.6L9,11.6V5z M2,13V5h5v8H2z M11.3,12.7c0.4,0.2,0.8,0.3,1.2,0.3
c1.4,0,2.5-1.1,2.5-2.5C15,9.1,13.9,8,12.5,8C11.1,8,10,9.1,10,10.5c0,0.4,0.1,0.8,0.3,1.2L8,14l1,1L11.3,12.7z M11,10.5
C11,9.7,11.7,9,12.5,9c0.8,0,1.5,0.7,1.5,1.5c0,0.8-0.7,1.5-1.5,1.5C11.7,12,11,11.3,11,10.5z"/>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#252526;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#c5c5c5;}.icon-vs-action-blue{fill:#75beff;}</style></defs><title>PreviewInRightPanel_16x</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M16,1V15H10.121l-.56.561a1.5,1.5,0,0,1-2.122,0A1.469,1.469,0,0,1,7.1,15H0V1Z" style="display: none;"/></g><g id="iconBg"><path class="icon-vs-bg" d="M1,2V14H7.1a1.469,1.469,0,0,1,.341-.561L9,11.88V5h5V7.351a3.515,3.515,0,0,1,1,.707V2ZM7,13H2V5H7Z"/></g><g id="colorAction"><path class="icon-vs-action-blue" d="M12.5,8a2.5,2.5,0,0,0-2.084,3.877l-2.27,2.269a.5.5,0,0,0,.708.708l2.269-2.27A2.5,2.5,0,1,0,12.5,8Zm0,4A1.5,1.5,0,1,1,14,10.5,1.5,1.5,0,0,1,12.5,12Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 819 B

After

Width:  |  Height:  |  Size: 889 B

View file

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.st0{fill:#2d2d30}.st1{fill:none}.st2{fill:#c5c5c5}.st3{fill:#2b282e}</style><path class="st0" d="M11.949 4C11.697 1.756 9.811 0 7.5 0A4.505 4.505 0 0 0 3 4.5c0 .6.12 1.188.35 1.735L0 9.586v.828l2 2 3-2.999V16h11V4h-4.051z" id="outline" style="display: none;"/><g id="icon_x5F_bg"><circle class="st1" cx="7.5" cy="4.5" r="2.5"/><path class="st2" d="M12 10h1v3h-1zM10 11h1v2h-1zM8 12h1v1H8zM8 9h2v1H8z"/><path class="st2" d="M11.949 5a4.431 4.431 0 0 1-.226 1H14v8H7V8.95a4.447 4.447 0 0 1-1-.227V15h9V5h-3.051z"/><path class="st2" d="M10.294 8H12V7h-.762a4.527 4.527 0 0 1-.944 1zM11 4.5a3.5 3.5 0 1 0-7 0c0 .711.215 1.369.579 1.922L1 10l1 1 3.579-3.578A3.485 3.485 0 0 0 7.5 8 3.5 3.5 0 0 0 11 4.5zm-6 0a2.5 2.5 0 1 1 5 0 2.5 2.5 0 0 1-5 0z"/></g><g id="icon_x5F_fg"><path class="st1" d="M10 11h1v2h-1zM8 12h1v1H8zM8 9h2v1H8zM12 10h1v3h-1z"/><path class="st3" d="M11.724 6a4.469 4.469 0 0 1-.485 1H12v1h-1.706c-.771.616-1.733 1-2.794 1-.169 0-.333-.031-.5-.05V14h7V6h-2.276zM8 9h2v1H8V9zm1 4H8v-1h1v1zm2 0h-1v-2h1v2zm2 0h-1v-3h1v3z"/><circle class="st3" cx="7.5" cy="4.5" r="2.5"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.icon-canvas-transparent,.icon-vs-out{fill:#252526;}.icon-canvas-transparent{opacity:0;}.icon-vs-bg{fill:#c5c5c5;}.icon-vs-action-blue{fill:#75beff;}</style></defs><title>SwitchToPreview_16x</title><g id="canvas"><path class="icon-canvas-transparent" d="M16,0V16H0V0Z"/></g><g id="outline" style="display: none;"><path class="icon-vs-out" d="M16,4V16H5V9.121l-1.939,1.94A1.5,1.5,0,0,1,.939,8.939L3.446,6.433A4.4,4.4,0,0,1,3,4.5,4.488,4.488,0,0,1,11.949,4Z" style="display: none;"/></g><g id="iconBg"><path class="icon-vs-bg" d="M12,10h1v3H12Zm0-3h-.762a4.5,4.5,0,0,1-.944,1H12Zm-2,6h1V11H10Zm2-8h-.051a4.485,4.485,0,0,1-.225,1H14v8H7V8.972a4.4,4.4,0,0,1-1-.237V15h9V5ZM9,12H8v1H9Zm1-3H8v1h2Z"/></g><g id="colorAction"><path class="icon-vs-action-blue" d="M7.5,1A3.5,3.5,0,0,0,4,4.5a3.463,3.463,0,0,0,.707,2.086L1.646,9.646a.5.5,0,0,0,.708.708l3.06-3.061A3.463,3.463,0,0,0,7.5,8a3.5,3.5,0,0,0,0-7Zm0,6A2.5,2.5,0,1,1,10,4.5,2.5,2.5,0,0,1,7.5,7Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,177 @@
/*
https://raw.githubusercontent.com/isagalaev/highlight.js/master/src/styles/vs2015.css
*/
/*
* Visual Studio 2015 dark style
* Author: Nicolas LLOBERA <nllobera@gmail.com>
*/
.hljs-keyword,
.hljs-literal,
.hljs-symbol,
.hljs-name {
color: #569CD6;
}
.hljs-link {
color: #569CD6;
text-decoration: underline;
}
.hljs-built_in,
.hljs-type {
color: #4EC9B0;
}
.hljs-number,
.hljs-class {
color: #B8D7A3;
}
.hljs-string,
.hljs-meta-string {
color: #D69D85;
}
.hljs-regexp,
.hljs-template-tag {
color: #9A5334;
}
.hljs-subst,
.hljs-function,
.hljs-title,
.hljs-params,
.hljs-formula {
color: #DCDCDC;
}
.hljs-comment,
.hljs-quote {
color: #57A64A;
font-style: italic;
}
.hljs-doctag {
color: #608B4E;
}
.hljs-meta,
.hljs-meta-keyword,
.hljs-tag {
color: #9B9B9B;
}
.hljs-variable,
.hljs-template-variable {
color: #BD63C5;
}
.hljs-attr,
.hljs-attribute,
.hljs-builtin-name {
color: #9CDCFE;
}
.hljs-section {
color: gold;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
/*.hljs-code {
font-family:'Monospace';
}*/
.hljs-bullet,
.hljs-selector-tag,
.hljs-selector-id,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #D7BA7D;
}
.hljs-addition {
background-color: #144212;
display: inline-block;
width: 100%;
}
.hljs-deletion {
background-color: #600;
display: inline-block;
width: 100%;
}
/*
From https://raw.githubusercontent.com/isagalaev/highlight.js/master/src/styles/vs.css
*/
/*
Visual Studio-like style based on original C# coloring by Jason Diamond <jason@diamond.name>
*/
.vscode-light .hljs-comment,
.vscode-light .hljs-quote,
.vscode-light .hljs-variable {
color: #008000;
}
.vscode-light .hljs-keyword,
.vscode-light .hljs-selector-tag,
.vscode-light .hljs-built_in,
.vscode-light .hljs-name,
.vscode-light .hljs-tag {
color: #00f;
}
.vscode-light .hljs-string,
.vscode-light .hljs-title,
.vscode-light .hljs-section,
.vscode-light .hljs-attribute,
.vscode-light .hljs-literal,
.vscode-light .hljs-template-tag,
.vscode-light .hljs-template-variable,
.vscode-light .hljs-type,
.vscode-light .hljs-addition {
color: #a31515;
}
.vscode-light .hljs-deletion,
.vscode-light .hljs-selector-attr,
.vscode-light .hljs-selector-pseudo,
.vscode-light .hljs-meta {
color: #2b91af;
}
.vscode-light .hljs-doctag {
color: #808080;
}
.vscode-light .hljs-attr {
color: #f00;
}
.vscode-light .hljs-symbol,
.vscode-light .hljs-bullet,
.vscode-light .hljs-link {
color: #00b0e8;
}
.vscode-light .hljs-emphasis {
font-style: italic;
}
.vscode-light .hljs-strong {
font-weight: bold;
}

View file

@ -1,73 +0,0 @@
/* Tomorrow Theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
/* Tomorrow Comment */
.hljs-comment,
.hljs-quote {
color: #8e908c;
}
/* Tomorrow Red */
.hljs-variable,
.hljs-template-variable,
.hljs-tag,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class,
.hljs-regexp,
.hljs-deletion {
color: #c82829;
}
/* Tomorrow Orange */
.hljs-number,
.hljs-built_in,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params,
.hljs-meta,
.hljs-link {
color: #f5871f;
}
/* Tomorrow Yellow */
.hljs-attribute {
color: #eab700;
}
/* Tomorrow Green */
.hljs-string,
.hljs-symbol,
.hljs-bullet,
.hljs-addition {
color: #718c00;
}
/* Tomorrow Blue */
.hljs-title,
.hljs-section {
color: #4271ae;
}
/* Tomorrow Purple */
.hljs-keyword,
.hljs-selector-tag {
color: #8959a8;
}
.hljs {
display: block;
overflow-x: auto;
color: #4d4d4c;
padding: 0.5em;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

View file

@ -23,7 +23,7 @@
"onCommand:markdown.showLockedPreviewToSide",
"onCommand:markdown.showSource",
"onCommand:markdown.showPreviewSecuritySelector",
"onView:markdown.preview"
"onWebviewPanel:markdown.preview"
],
"contributes": {
"commands": [
@ -278,7 +278,7 @@
],
"markdown.previewStyles": [
"./media/markdown.css",
"./media/tomorrow.css"
"./media/highlight.css"
],
"markdown.previewScripts": [
"./media/index.js"

View file

@ -46,10 +46,10 @@ export class OpenDocumentLinkCommand implements Command {
}
private async tryOpen(path: string, args: OpenDocumentLinkArgs) {
if (vscode.window.activeTextEditor && isMarkdownFile(vscode.window.activeTextEditor.document) && vscode.window.activeTextEditor.document.uri.fsPath === path) {
const resource = vscode.Uri.file(path);
if (vscode.window.activeTextEditor && isMarkdownFile(vscode.window.activeTextEditor.document) && vscode.window.activeTextEditor.document.uri.fsPath === resource.fsPath) {
return this.tryRevealLine(vscode.window.activeTextEditor, args.fragment);
} else {
const resource = vscode.Uri.file(path);
return vscode.workspace.openTextDocument(resource)
.then(vscode.window.showTextDocument)
.then(editor => this.tryRevealLine(editor, args.fragment));

View file

@ -17,6 +17,7 @@ import { MarkdownEngine } from './markdownEngine';
import { getMarkdownExtensionContributions } from './markdownExtensions';
import { ExtensionContentSecurityPolicyArbiter, PreviewSecuritySelector } from './security';
import { loadDefaultTelemetryReporter } from './telemetryReporter';
import { githubSlugifier } from './slugify';
export function activate(context: vscode.ExtensionContext) {
@ -26,7 +27,7 @@ export function activate(context: vscode.ExtensionContext) {
const contributions = getMarkdownExtensionContributions();
const cspArbiter = new ExtensionContentSecurityPolicyArbiter(context.globalState, context.workspaceState);
const engine = new MarkdownEngine(contributions);
const engine = new MarkdownEngine(contributions, githubSlugifier);
const logger = new Logger();
const selector: vscode.DocumentSelector = [

View file

@ -116,6 +116,8 @@ export class MarkdownPreviewManager implements vscode.WebviewPanelSerializer {
this.topmostLineMonitor,
this.contributions);
vscode.commands.executeCommand('setContext', MarkdownPreviewManager.markdownPreviewActiveContextKey, true);
return this.registerPreview(preview);
}

View file

@ -3,11 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as path from 'path';
import { Slug } from './tableOfContentsProvider';
import { MarkdownIt, Token } from 'markdown-it';
import * as path from 'path';
import * as vscode from 'vscode';
import { MarkdownContributions } from './markdownExtensions';
import { Slugifier } from './slugify';
const FrontMatterRegex = /^---\s*[^]*?(-{3}|\.{3})\s*/;
@ -19,7 +19,8 @@ export class MarkdownEngine {
private currentDocument?: vscode.Uri;
public constructor(
private readonly extensionPreviewResourceProvider: MarkdownContributions
private readonly extensionPreviewResourceProvider: MarkdownContributions,
private readonly slugifier: Slugifier,
) { }
private usePlugin(factory: (md: any) => any): void {
@ -43,23 +44,25 @@ export class MarkdownEngine {
}
if (lang && hljs.getLanguage(lang)) {
try {
return `<pre class="hljs"><code><div>${hljs.highlight(lang, str, true).value}</div></code></pre>`;
return `<div>${hljs.highlight(lang, str, true).value}</div>`;
} catch (error) { }
}
return `<pre class="hljs"><code><div>${this.md!.utils.escapeHtml(str)}</div></code></pre>`;
return `<code><div>${this.md!.utils.escapeHtml(str)}</div>`;
}
}).use(mdnh, {
slugify: (header: string) => Slug.fromHeading(header).value
slugify: (header: string) => this.slugifier.fromHeading(header).value
});
for (const plugin of this.extensionPreviewResourceProvider.markdownItPlugins) {
this.usePlugin(await plugin);
}
for (const renderName of ['paragraph_open', 'heading_open', 'image', 'code_block', 'blockquote_open', 'list_item_open']) {
for (const renderName of ['paragraph_open', 'heading_open', 'image', 'code_block', 'fence', 'blockquote_open', 'list_item_open']) {
this.addLineNumberRenderer(this.md, renderName);
}
this.addFencedRenderer(this.md);
this.addLinkNormalizer(this.md);
this.addLinkValidator(this.md);
}
@ -126,6 +129,18 @@ export class MarkdownEngine {
};
}
private addFencedRenderer(md: any): void {
const original = md.renderer.rules['fenced'];
md.renderer.rules['fenced'] = (tokens: any, idx: number, options: any, env: any, self: any) => {
const token = tokens[idx];
if (token.map && token.map.length) {
token.attrJoin('class', 'hljs');
}
return original(tokens, idx, options, env, self);
};
}
private addLinkNormalizer(md: any): void {
const normalizeLink = md.normalizeLink;
md.normalizeLink = (link: string) => {
@ -145,13 +160,13 @@ export class MarkdownEngine {
if (fragment) {
uri = uri.with({
fragment: Slug.fromHeading(fragment).value
fragment: this.slugifier.fromHeading(fragment).value
});
}
return normalizeLink(uri.with({ scheme: 'vscode-resource' }).toString(true));
} else if (!uri.scheme && !uri.path && uri.fragment) {
return normalizeLink(uri.with({
fragment: Slug.fromHeading(uri.fragment).value
fragment: this.slugifier.fromHeading(uri.fragment).value
}).toString(true));
}
} catch (e) {

View file

@ -0,0 +1,32 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export class Slug {
public constructor(
public readonly value: string
) { }
public equals(other: Slug): boolean {
return this.value === other.value;
}
}
export interface Slugifier {
fromHeading(heading: string): Slug;
}
export const githubSlugifier: Slugifier = new class implements Slugifier {
fromHeading(heading: string): Slug {
const slugifiedHeading = encodeURI(
heading.trim()
.toLowerCase()
.replace(/\s+/g, '-') // Replace whitespace with -
.replace(/[\]\[\!\'\#\$\%\&\'\(\)\*\+\,\.\/\:\;\<\=\>\?\@\\\^\_\{\|\}\~\`]/g, '') // Remove known puctuators
.replace(/^\-+/, '') // Remove leading -
.replace(/\-+$/, '') // Remove trailing -
);
return new Slug(slugifiedHeading);
}
};

View file

@ -4,34 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import { MarkdownEngine } from './markdownEngine';
export class Slug {
private static specialChars: any = { 'à': 'a', 'ä': 'a', 'ã': 'a', 'á': 'a', 'â': 'a', 'æ': 'a', 'å': 'a', 'ë': 'e', 'è': 'e', 'é': 'e', 'ê': 'e', 'î': 'i', 'ï': 'i', 'ì': 'i', 'í': 'i', 'ò': 'o', 'ó': 'o', 'ö': 'o', 'ô': 'o', 'ø': 'o', 'ù': 'o', 'ú': 'u', 'ü': 'u', 'û': 'u', 'ñ': 'n', 'ç': 'c', 'ß': 's', 'ÿ': 'y', 'œ': 'o', 'ŕ': 'r', 'ś': 's', 'ń': 'n', 'ṕ': 'p', 'ẃ': 'w', 'ǵ': 'g', 'ǹ': 'n', 'ḿ': 'm', 'ǘ': 'u', 'ẍ': 'x', 'ź': 'z', 'ḧ': 'h', '·': '-', '/': '-', '_': '-', ',': '-', ':': '-', ';': '-', 'З': '3', 'з': '3' };
public static fromHeading(heading: string): Slug {
const slugifiedHeading = encodeURI(heading.trim()
.toLowerCase()
.replace(/./g, c => Slug.specialChars[c] || c)
.replace(/[\]\[\!\'\#\$\%\&\'\(\)\*\+\,\.\/\:\;\<\=\>\?\@\\\^\_\{\|\}\~\`]/g, '')
.replace(/\s+/g, '-') // Replace whitespace with -
.replace(/[^\w\-]+/g, '') // Remove remaining non-word chars
.replace(/^\-+/, '') // Remove leading -
.replace(/\-+$/, '') // Remove trailing -
);
return new Slug(slugifiedHeading);
}
private constructor(
public readonly value: string
) { }
public equals(other: Slug): boolean {
return this.value === other.value;
}
}
import { Slug, githubSlugifier } from './slugify';
export interface TocEntry {
readonly slug: Slug;
@ -62,7 +36,7 @@ export class TableOfContentsProvider {
public async lookup(fragment: string): Promise<TocEntry | undefined> {
const toc = await this.getToc();
const slug = Slug.fromHeading(fragment);
const slug = githubSlugifier.fromHeading(fragment);
return toc.find(entry => entry.slug.equals(slug));
}
@ -74,7 +48,7 @@ export class TableOfContentsProvider {
const lineNumber = heading.map[0];
const line = document.lineAt(lineNumber);
toc.push({
slug: Slug.fromHeading(line.text),
slug: githubSlugifier.fromHeading(line.text),
text: TableOfContentsProvider.getHeaderText(line.text),
level: TableOfContentsProvider.getHeaderLevel(heading.markup),
line: lineNumber,

View file

@ -6,13 +6,15 @@
import * as vscode from 'vscode';
import { MarkdownEngine } from '../markdownEngine';
import { MarkdownContributions } from '../markdownExtensions';
import { githubSlugifier } from '../slugify';
const emptyContributions = new class implements MarkdownContributions {
readonly previewScripts: vscode.Uri[] = [];
readonly previewStyles: vscode.Uri[] = [];
readonly previewResourceRoots: vscode.Uri[] = [];
readonly markdownItPlugins: Promise<(md: any) => any>[] = [];
};
export function createNewMarkdownEngine(): MarkdownEngine {
return new MarkdownEngine(new class implements MarkdownContributions {
readonly previewScripts: vscode.Uri[] = [];
readonly previewStyles: vscode.Uri[] = [];
readonly previewResourceRoots: vscode.Uri[] = [];
readonly markdownItPlugins: Promise<(md: any) => any>[] = [];
});
return new MarkdownEngine(emptyContributions, githubSlugifier);
}

View file

@ -75,18 +75,35 @@ suite('markdown.TableOfContentsProvider', () => {
assert.strictEqual(await provider.lookup('fo o'), undefined);
});
test('should normalize special characters #44779', async () => {
test('should handle special characters #44779', async () => {
const doc = new InMemoryDocument(testFileName, `# Indentação\n`);
const provider = new TableOfContentsProvider(createNewMarkdownEngine(), doc);
assert.strictEqual((await provider.lookup('indentacao'))!.line, 0);
assert.strictEqual((await provider.lookup('indentação'))!.line, 0);
});
test('should map special З, #37079', async () => {
const doc = new InMemoryDocument(testFileName, `### Заголовок Header 3`);
test('should handle special characters 2, #48482', async () => {
const doc = new InMemoryDocument(testFileName, `# Инструкция - Делай Раз, Делай Два\n`);
const provider = new TableOfContentsProvider(createNewMarkdownEngine(), doc);
assert.strictEqual((await provider.lookup('Заголовок-header-3'))!.line, 0);
assert.strictEqual((await provider.lookup('3аголовок-header-3'))!.line, 0);
assert.strictEqual((await provider.lookup('инструкция---делай-раз-делай-два'))!.line, 0);
});
test('should handle special characters 3, #37079', async () => {
const doc = new InMemoryDocument(testFileName, `## Header 2
### Header 3
## Заголовок 2
### Заголовок 3
### Заголовок Header 3
## Заголовок`);
const provider = new TableOfContentsProvider(createNewMarkdownEngine(), doc);
assert.strictEqual((await provider.lookup('header-2'))!.line, 0);
assert.strictEqual((await provider.lookup('header-3'))!.line, 1);
assert.strictEqual((await provider.lookup('Заголовок-2'))!.line, 2);
assert.strictEqual((await provider.lookup('Заголовок-3'))!.line, 3);
assert.strictEqual((await provider.lookup('Заголовок-header-3'))!.line, 4);
assert.strictEqual((await provider.lookup('Заголовок'))!.line, 5);
});
});

View file

@ -18,7 +18,7 @@ export class MarkdownFileTopmostLineMonitor {
vscode.window.onDidChangeTextEditorVisibleRanges(event => {
if (isMarkdownFile(event.textEditor.document)) {
const line = getVisibleLine(event.textEditor);
if (line) {
if (typeof line === 'number') {
this.updateLine(event.textEditor.document.uri, line);
}
}

View file

@ -1,6 +1,6 @@
# Node npm
**Notice** This is a an extension that is bundled with Visual Studio Code.
**Notice** This is a an extension that is bundled with Visual Studio Code.
This extension supports running npm scripts defined in the `package.json` as [tasks](https://code.visualstudio.com/docs/editor/tasks). Scripts with the name 'build', 'compile', or 'watch'
are treated as build tasks.
@ -15,3 +15,4 @@ For more information about auto detection of Tasks pls see the [documentation](h
- `npm.packageManager` the package manager used to run the scripts: `npm` or `yarn`, the default is `npm`.
- `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 '&ast;&ast;/test/&ast;&ast;'.
- `npm.enableScriptExplorer` enable an explorer view for npm scripts.
- `npm.scriptExplorerAction` the default click action: `open` or `run`, the default is `open`.

View file

@ -33,6 +33,14 @@
"onView:npm"
],
"contributes": {
"languages": [
{
"id": "ignore",
"filenames": [
".npmignore"
]
}
],
"views": {
"explorer": [
{
@ -53,12 +61,20 @@
},
{
"command": "npm.debugScript",
"title": "%command.debug%"
"title": "%command.debug%",
"icon": {
"light": "resources/light/debug.svg",
"dark": "resources/dark/debug.svg"
}
},
{
"command": "npm.openScript",
"title": "%command.openScript%"
},
{
"command": "npm.runInstall",
"title": "%command.runInstall%"
},
{
"command": "npm.refresh",
"title": "%command.refresh%",
@ -80,9 +96,13 @@
{
"command": "npm.openScript",
"when": "view == npm && viewItem == packageJSON",
"group": "navigation"
"group": "navigation@1"
},
{
"command": "npm.runInstall",
"when": "view == npm && viewItem == packageJSON",
"group": "navigation@2"
}, {
"command": "npm.openScript",
"when": "view == npm && viewItem == script",
"group": "navigation@1"
@ -93,9 +113,19 @@
"group": "navigation@2"
},
{
"command": "npm.runScript",
"when": "view == npm && viewItem == script",
"group": "inline"
"command": "npm.runScript",
"when": "view == npm && viewItem == script",
"group": "inline"
},
{
"command": "npm.runScript",
"when": "view == npm && viewItem == debugScript",
"group": "inline"
},
{
"command": "npm.debugScript",
"when": "view == npm && viewItem == debugScript",
"group": "inline"
},
{
"command": "npm.debugScript",
@ -151,6 +181,16 @@
"default": false,
"scope": "resource",
"description": "%config.npm.enableScriptExplorer%"
},
"npm.scriptExplorerAction": {
"type": "string",
"enum": [
"open",
"run"
],
"description": "%config.npm.scriptExplorerAction%",
"scope": "window",
"default": "open"
}
}
},

View file

@ -6,6 +6,7 @@
"config.npm.packageManager": "The package manager used to run scripts.",
"config.npm.exclude": "Configure glob patterns for folders that should be excluded from automatic script detection.",
"config.npm.enableScriptExplorer": "Enable an explorer view for npm scripts.",
"config.npm.scriptExplorerAction": "The default click action used in the scripts explorer: 'open' or 'run', the default is 'open'.",
"npm.parseError": "Npm task detection: failed to parse the file {0}",
"taskdef.script": "The npm script to customize.",
"taskdef.path": "The path to the folder of the package.json file that provides the script. Can be omitted.",
@ -13,5 +14,6 @@
"command.refresh": "Refresh",
"command.run": "Run",
"command.debug": "Debug",
"command.openScript": "Open"
"command.openScript": "Open",
"command.runInstall": "Run Install"
}

View file

@ -0,0 +1,7 @@
<!-- Generated by IcoMoon.io -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="12" height="12" style="fill:#C5C5C5;fill-opacity:1;" viewBox="0 0 512 512">
<title></title>
<g id="icomoon-ignore">
</g>
<path d="M512 288v-32h-96.645c-2.931-36.343-15.893-69.513-35.835-96.125h80.972l35.030-140.12-31.045-7.761-28.97 115.88h-87.34c-0.446-0.347-0.898-0.687-1.349-1.028 3.355-9.751 5.181-20.211 5.181-31.097 0.001-52.88-42.979-95.749-95.999-95.749s-96 42.869-96 95.75c0 10.886 1.825 21.346 5.181 31.097-0.45 0.342-0.902 0.681-1.349 1.028h-87.34l-28.97-115.88-31.045 7.761 35.030 140.12h80.972c-19.942 26.611-32.903 59.781-35.834 96.124h-96.645v32h96.685c1.901 22.832 7.754 44.406 16.819 63.875h-61.996l-35.030 140.119 31.045 7.762 28.97-115.881h56.177c29.346 39.016 73.698 63.875 123.33 63.875s93.983-24.859 123.331-63.875h56.177l28.97 115.881 31.045-7.762-35.030-140.119h-61.996c9.065-19.469 14.918-41.043 16.818-63.875h96.685z"></path>
</svg>

After

Width:  |  Height:  |  Size: 953 B

View file

@ -0,0 +1,7 @@
<!-- Generated by IcoMoon.io -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="12" height="12" style="fill:#464D46;fill-opacity:1;" viewBox="0 0 512 512">
<title></title>
<g id="icomoon-ignore">
</g>
<path d="M512 288v-32h-96.645c-2.931-36.343-15.893-69.513-35.835-96.125h80.972l35.030-140.12-31.045-7.761-28.97 115.88h-87.34c-0.446-0.347-0.898-0.687-1.349-1.028 3.355-9.751 5.181-20.211 5.181-31.097 0.001-52.88-42.979-95.749-95.999-95.749s-96 42.869-96 95.75c0 10.886 1.825 21.346 5.181 31.097-0.45 0.342-0.902 0.681-1.349 1.028h-87.34l-28.97-115.88-31.045 7.761 35.030 140.12h80.972c-19.942 26.611-32.903 59.781-35.834 96.124h-96.645v32h96.685c1.901 22.832 7.754 44.406 16.819 63.875h-61.996l-35.030 140.119 31.045 7.762 28.97-115.881h56.177c29.346 39.016 73.698 63.875 123.33 63.875s93.983-24.859 123.331-63.875h56.177l28.97 115.881 31.045-7.762-35.030-140.119h-61.996c9.065-19.469 14.918-41.043 16.818-63.875h96.685z"></path>
</svg>

After

Width:  |  Height:  |  Size: 953 B

View file

@ -288,6 +288,9 @@ export class PackageJSONContribution implements IJSONContribution {
if (latest) {
result.push(localize('json.npm.version.hover', 'Latest version: {0}', latest));
}
if (obj.homepage) {
result.push(obj.homepage);
}
return result;
}
} catch (e) {

View file

@ -25,6 +25,11 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
treeDataProvider.refresh();
}
}
if (e.affectsConfiguration('npm.scriptExplorerAction')) {
if (treeDataProvider) {
treeDataProvider.refresh();
}
}
});
context.subscriptions.push(addJSONProviders(httpRequest.xhr));
}

View file

@ -11,7 +11,10 @@ import {
WorkspaceFolder, commands, debug, window, workspace, Selection, TaskGroup
} from 'vscode';
import { visit, JSONVisitor } from 'jsonc-parser';
import { NpmTaskDefinition, getPackageJsonUriFromTask, getScripts, isWorkspaceFolder, getPackageManager, getTaskName } from './tasks';
import {
NpmTaskDefinition, getPackageJsonUriFromTask, getScripts,
isWorkspaceFolder, getPackageManager, getTaskName, createTask
} from './tasks';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
@ -65,20 +68,36 @@ class PackageJSON extends TreeItem {
}
}
type ExplorerCommands = 'open' | 'run';
class NpmScript extends TreeItem {
task: Task;
package: PackageJSON;
constructor(context: ExtensionContext, packageJson: PackageJSON, task: Task) {
super(task.name, TreeItemCollapsibleState.None);
const command: ExplorerCommands = workspace.getConfiguration('npm').get<ExplorerCommands>('scriptExplorerAction') || 'open';
const commandList = {
'open': {
title: 'Edit Script',
command: 'npm.openScript',
arguments: [this]
},
'run': {
title: 'Run Script',
command: 'npm.runScript',
arguments: [this]
}
};
this.contextValue = 'script';
if (task.group && task.group === TaskGroup.Rebuild) {
this.contextValue = 'debugScript';
}
this.package = packageJson;
this.task = task;
this.command = {
title: 'Run Script',
command: 'npm.openScript',
arguments: [this]
};
this.command = commandList[command];
if (task.group && task.group === TaskGroup.Clean) {
this.iconPath = {
light: context.asAbsolutePath(path.join('resources', 'light', 'prepostscript.svg')),
@ -117,6 +136,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
subscriptions.push(commands.registerCommand('npm.debugScript', this.debugScript, this));
subscriptions.push(commands.registerCommand('npm.openScript', this.openScript, this));
subscriptions.push(commands.registerCommand('npm.refresh', this.refresh, this));
subscriptions.push(commands.registerCommand('npm.runInstall', this.runInstall, this));
}
private scriptIsValid(scripts: any, task: Task): boolean {
@ -141,7 +161,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
workspace.executeTask(script.task);
}
private async extractDebugArg(scripts: any, task: Task): Promise<[string, number] | undefined> {
private extractDebugArg(scripts: any, task: Task): [string, number] | undefined {
let script: string = scripts[task.name];
let match = script.match(/--(inspect|debug)(-brk)?(=(\d*))?/);
@ -242,6 +262,19 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
return scriptOffset;
}
private async runInstall(selection: PackageJSON) {
let uri: Uri | undefined = undefined;
if (selection instanceof PackageJSON) {
uri = selection.resourceUri;
}
if (!uri) {
return;
}
let task = createTask('install', 'install', selection.folder.workspaceFolder, uri, []);
workspace.executeTask(task);
}
private async openScript(selection: PackageJSON | NpmScript) {
let uri: Uri | undefined = undefined;
if (selection instanceof PackageJSON) {

View file

@ -58,7 +58,7 @@ function getPrePostScripts(scripts: any): Set<string> {
const script = keys[i];
const prepost = ['pre' + script, 'post' + script];
prepost.forEach(each => {
if (scripts[each]) {
if (scripts[each] !== undefined) {
prePostScripts.add(each);
}
});
@ -142,21 +142,27 @@ function isExcluded(folder: WorkspaceFolder, packageJsonUri: Uri) {
}
let exclude = workspace.getConfiguration('npm', folder.uri).get<string | string[]>('exclude');
let packageJsonFolder = path.dirname(packageJsonUri.fsPath);
if (exclude) {
if (Array.isArray(exclude)) {
for (let pattern of exclude) {
if (testForExclusionPattern(packageJsonUri.fsPath, pattern)) {
if (testForExclusionPattern(packageJsonFolder, pattern)) {
return true;
}
}
} else if (testForExclusionPattern(packageJsonUri.fsPath, exclude)) {
} else if (testForExclusionPattern(packageJsonFolder, exclude)) {
return true;
}
}
return false;
}
function isDebugScript(script: string): boolean {
let match = script.match(/--(inspect|debug)(-brk)?(=(\d*))?/);
return match !== null;
}
async function provideNpmScriptsForFolder(packageJsonUri: Uri): Promise<Task[]> {
let emptyTasks: Task[] = [];
@ -183,6 +189,9 @@ async function provideNpmScriptsForFolder(packageJsonUri: Uri): Promise<Task[]>
if (prePostScripts.has(each)) {
task.group = TaskGroup.Clean; // hack: use Clean group to tag pre/post scripts
}
if (isDebugScript(scripts![each])) {
task.group = TaskGroup.Rebuild; // hack: use Rebuild group to tag debug scripts
}
result.push(task);
});
// always add npm install (without a problem matcher)
@ -197,7 +206,7 @@ export function getTaskName(script: string, relativePath: string | undefined) {
return script;
}
function createTask(script: string, cmd: string, folder: WorkspaceFolder, packageJsonUri: Uri, matcher?: any): Task {
export function createTask(script: string, cmd: string, folder: WorkspaceFolder, packageJsonUri: Uri, matcher?: any): Task {
function getCommandLine(folder: WorkspaceFolder, cmd: string): string {
let packageManager = getPackageManager(folder);

View file

@ -8,8 +8,6 @@
"outDir": "./out",
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true
},
"include": [

View file

@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "Dependencies shared by all extensions",
"dependencies": {
"typescript": "2.9.1-insiders.20180516"
"typescript": "2.9.1"
},
"scripts": {
"postinstall": "node ./postinstall"

View file

@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/PowerShell/EditorSyntax/commit/e6e207044299a7121b4ed92c9762f51e1c23d0dd",
"version": "https://github.com/PowerShell/EditorSyntax/commit/529562fbe4ba9abde22282ee8b00141284968f4b",
"name": "PowerShell",
"scopeName": "source.powershell",
"patterns": [
@ -12,13 +12,13 @@
"begin": "<#",
"beginCaptures": {
"0": {
"name": "punctuation.start.definition.comment.block.powershell"
"name": "punctuation.definition.comment.block.begin.powershell"
}
},
"end": "#>",
"endCaptures": {
"0": {
"name": "punctuation.end.definition.comment.block.powershell"
"name": "punctuation.definition.comment.block.end.powershell"
}
},
"name": "comment.block.powershell",
@ -28,19 +28,6 @@
}
]
},
{
"begin": "(?<![`\\\\-])#",
"end": "$",
"name": "comment.line.number-sign.powershell",
"patterns": [
{
"include": "#commentEmbeddedDocs"
},
{
"include": "#RequiresDirective"
}
]
},
{
"match": "[2-6]>&1|>>|>|<<|<|>|>\\||[1-6]>|[1-6]>>",
"name": "keyword.operator.redirection.powershell"
@ -48,6 +35,9 @@
{
"include": "#commands"
},
{
"include": "#commentLine"
},
{
"include": "#variable"
},
@ -70,24 +60,10 @@
"include": "#hashtable"
},
{
"begin": "(?<!(?<!`)\")\"",
"end": "\"(?!\")",
"name": "string.quoted.double.powershell",
"patterns": [
{
"include": "#variableNoProperty"
},
{
"include": "#doubleQuotedStringEscapes"
},
{
"include": "#interpolation"
},
{
"match": "`\\s*$",
"name": "keyword.other.powershell"
}
]
"include": "#doubleQuotedString"
},
{
"include": "#scriptblock"
},
{
"comment": "Needed to parse stuff correctly in 'argument mode'. (See about_parsing.)",
@ -135,13 +111,21 @@
"include": "#numericConstant"
},
{
"begin": "@\\(",
"captures": {
"0": {
"name": "keyword.other.powershell"
"begin": "(@)(\\()",
"beginCaptures": {
"1": {
"name": "keyword.other.array.begin.powershell"
},
"2": {
"name": "punctuation.section.group.begin.powershell"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.section.group.end.powershell"
}
},
"name": "meta.group.array-expression.powershell",
"patterns": [
{
@ -150,14 +134,22 @@
]
},
{
"begin": "\\$\\(",
"captures": {
"0": {
"name": "keyword.other.powershell"
"begin": "(\\$)(\\()",
"beginCaptures": {
"1": {
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "punctuation.section.group.begin.powershell"
}
},
"comment": "TODO: move to repo; make recursive.",
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.section.group.end.powershell"
}
},
"name": "meta.group.complex.subexpression.powershell",
"patterns": [
{
@ -174,7 +166,11 @@
"name": "support.function.powershell"
},
{
"match": "(?<!\\w)((?i:begin|break|catch|continue|data|define|do|dynamicparam|else|elseif|end|exit|finally|for|foreach(?!-object)|from|if|in|inlinescript|parallel|param|process|return|switch|throw|trap|try|until|var|where(?!-object)|while)|%|\\?)(?!\\w)",
"match": "(?<!\\w|-)((?i:begin|break|catch|continue|data|default|define|do|dynamicparam|else|elseif|end|exit|finally|for|foreach(?!-object)|from|if|in|inlinescript|parallel|param|process|return|switch|throw|trap|try|until|var|where(?!-object)|while)|%|\\?)(?!\\w)",
"name": "keyword.control.powershell"
},
{
"match": "(?<!\\w)(--%)(?!\\w)",
"name": "keyword.control.powershell"
},
{
@ -232,51 +228,112 @@
},
{
"comment": "This is very imprecise, is there a syntax for 'must come after...' ",
"match": "(?<!\\s|^)\\.\\.(?=\\d|\\(|\\$)",
"match": "(?<!\\s|^)\\.\\.(?=\\-?\\d|\\(|\\$)",
"name": "keyword.operator.range.powershell"
}
],
"repository": {
"attribute": {
"begin": "\\[(\\p{L}|\\.|``\\d+)+(?=\\()",
"beginCaptures": {
"commentLine": {
"begin": "(?<![`\\\\-])#",
"captures": {
"0": {
"name": "entity.name.tag"
"name": "punctuation.definition.comment.powershell"
}
},
"end": "$",
"name": "comment.line.powershell",
"patterns": [
{
"include": "#commentEmbeddedDocs"
},
{
"include": "#RequiresDirective"
}
]
},
"attribute": {
"begin": "(\\[)\\s*\\b(?i)(cmdletbinding|alias|outputtype|parameter|validatenotnull|validatenotnullorempty|validatecount|validateset|allownull|allowemptycollection|allowemptystring|validatescript|validaterange|validatepattern|validatelength)\\b",
"beginCaptures": {
"1": {
"name": "entity.name.tag"
"name": "punctuation.section.bracket.begin.powershell"
},
"2": {
"name": "support.function.attribute.powershell"
}
},
"end": "\\]",
"end": "(\\])",
"endCaptures": {
"0": {
"name": "entity.name.tag"
"1": {
"name": "punctuation.section.bracket.end.powershell"
}
},
"name": "meta.attribute.powershell",
"patterns": [
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.section.group.begin.powershell"
}
},
"end": "\\)",
"name": "entity.other.attribute-name",
"endCaptures": {
"0": {
"name": "punctuation.section.group.end.powershell"
}
},
"patterns": [
{
"captures": {
"0": {
"name": "entity.other.attribute.parameter.powershell"
},
"1": {
"name": "constant.language.powershell"
},
"2": {
"name": "variable.other.powershell"
}
},
"comment": "really we should match the known attributes first",
"match": "(\\w+)\\s*=?([^\"']*?|'[^']*?'|\"[^\"]*?\")?(?=,|\\))",
"name": "entity.other.attribute-name.powershell"
"include": "#variable"
},
{
"include": "#variable"
"include": "#variableNoProperty"
},
{
"include": "#hashtable"
},
{
"include": "#scriptblock"
},
{
"include": "#doubleQuotedStringEscapes"
},
{
"include": "#doubleQuotedString"
},
{
"include": "#type"
},
{
"include": "#numericConstant"
},
{
"include": "#doubleQuotedString"
},
{
"include": "$self"
},
{
"match": "(?i)\\b(mandatory|valuefrompipeline|valuefrompipelinebypropertyname|valuefromremainingarguments|position|parametersetname|defaultparametersetname|supportsshouldprocess|positionalbinding|helpuri|confirmimpact|helpmessage)\\b(?:\\s+)?(=)",
"captures": {
"1": {
"name": "variable.parameter.attribute.powershell"
},
"2": {
"name": "keyword.operator.assignment.powershell"
}
}
},
{
"begin": "(?<!')'",
"end": "'(?!')",
"name": "string.quoted.single.powershell",
"patterns": [
{
"match": "''",
"name": "constant.character.escape.powershell"
}
]
}
]
}
@ -358,10 +415,10 @@
"begin": "^(?:\\s*+)(?i)(function|filter|configuration|workflow)\\s+(?:(global|local|script|private):)?((?:\\p{L}|\\d|_|-|\\.)+)",
"beginCaptures": {
"0": {
"name": "meta.function"
"name": "meta.function.powershell"
},
"1": {
"name": "storage.type"
"name": "storage.type.powershell"
},
"2": {
"name": "storage.modifier.scope.powershell"
@ -370,20 +427,25 @@
"name": "entity.name.function.powershell"
}
},
"end": "\\{|\\("
"end": "(?=\\{|\\()",
"patterns": [
{
"include": "#commentLine"
}
]
},
"interpolatedStringContent": {
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "keyword.other.powershell"
"name": "punctuation.section.group.begin.powershell"
}
},
"contentName": "interpolated.simple.source.powershell",
"end": "\\)",
"endCaptures": {
"0": {
"name": "keyword.other.powershell"
"name": "punctuation.section.group.end.powershell"
}
},
"patterns": [
@ -399,17 +461,20 @@
]
},
"interpolation": {
"begin": "(\\$)\\(",
"begin": "(\\$)(\\()",
"beginCaptures": {
"0": {
"name": "keyword.other.powershell"
"1": {
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "punctuation.section.group.begin.powershell"
}
},
"contentName": "interpolated.complex.source.powershell",
"end": "\\)",
"endCaptures": {
"0": {
"name": "keyword.other.powershell"
"name": "punctuation.section.group.end.powershell"
}
},
"patterns": [
@ -429,92 +494,95 @@
{
"captures": {
"1": {
"name": "constant.numeric.hexadecimal.powershell"
"name": "constant.numeric.hex.powershell"
},
"2": {
"name": "keyword.other.powershell"
}
},
"match": "(?<!\\w)([-+]?0(?:x|X)[0-9a-fA-F_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b",
"name": "constant.numeric.hexadecimal.powershell"
"match": "(?<!\\w)([-+]?0(?:x|X)[0-9a-fA-F_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b"
},
{
"captures": {
"1": {
"name": "constant.numeric.scientific.powershell"
"name": "constant.numeric.integer.powershell"
},
"2": {
"name": "keyword.other.powershell"
}
},
"match": "(?<!\\w)([-+]?(?:[0-9_]+)?\\.[0-9_]+(?:(?:e|E)[0-9]+)?(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b",
"name": "constant.numeric.scientific.powershell"
"match": "(?<!\\w)([-+]?(?:[0-9_]+)?\\.[0-9_]+(?:(?:e|E)[0-9]+)?(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b"
},
{
"captures": {
"1": {
"name": "constant.numeric.binary.powershell"
"name": "constant.numeric.octal.powershell"
},
"2": {
"name": "keyword.other.powershell"
}
},
"match": "(?<!\\w)([-+]?0(?:b|B)[01_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b",
"name": "constant.numeric.binary.powershell"
"match": "(?<!\\w)([-+]?0(?:b|B)[01_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b"
},
{
"captures": {
"1": {
"name": "constant.numeric.decimal.powershell"
"name": "constant.numeric.integer.powershell"
},
"2": {
"name": "keyword.other.powershell"
}
},
"match": "(?<!\\w)([-+]?[0-9_]+(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b",
"name": "constant.numeric.decimal.powershell"
"match": "(?<!\\w)([-+]?[0-9_]+(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b"
},
{
"captures": {
"1": {
"name": "constant.numeric.decimal.powershell"
"name": "constant.numeric.integer.powershell"
},
"2": {
"name": "keyword.other.powershell"
}
},
"match": "(?<!\\w)([-+]?[0-9_]+\\.(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b",
"name": "constant.numeric.decimal.powershell"
"match": "(?<!\\w)([-+]?[0-9_]+\\.(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b"
},
{
"captures": {
"1": {
"name": "constant.numeric.decimal.powershell"
"name": "constant.numeric.integer.powershell"
},
"2": {
"name": "keyword.other.powershell"
}
},
"match": "(?<!\\w)([-+]?[0-9_]+[\\.]?(?:F|f|D|d|M|m))((?i:[kmgtp]b)?)\\b",
"name": "constant.numeric.decimal.powershell"
"match": "(?<!\\w)([-+]?[0-9_]+[\\.]?(?:F|f|D|d|M|m))((?i:[kmgtp]b)?)\\b"
},
{
"captures": {
"1": {
"name": "constant.numeric.decimal.powershell"
"name": "constant.numeric.integer.powershell"
},
"2": {
"name": "keyword.other.powershell"
}
},
"match": "(?<!\\w)([-+]?[0-9_]+[\\.]?(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b",
"name": "constant.numeric.decimal.powershell"
"match": "(?<!\\w)([-+]?[0-9_]+[\\.]?(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b"
}
]
},
"scriptblock": {
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.section.braces.begin.powershell"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.section.braces.end.powershell"
}
},
"name": "meta.scriptblock.powershell",
"patterns": [
{
@ -526,20 +594,19 @@
"begin": "\\[",
"beginCaptures": {
"0": {
"name": "entity.other.attribute-name"
"name": "punctuation.section.bracket.begin.powershell"
}
},
"comment": "name should be entity.name.type but default schema doesn't have a good color for it",
"end": "\\]",
"endCaptures": {
"0": {
"name": "entity.other.attribute-name"
"name": "punctuation.section.bracket.end.powershell"
}
},
"patterns": [
{
"match": "(\\p{L}|\\.|``\\d+)+?",
"name": "entity.other.attribute-name"
"match": "(?!\\d+|\\.)(?:\\p{L}|\\p{N}|\\.)+",
"name": "storage.type.powershell"
},
{
"include": "$self"
@ -551,7 +618,7 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "constant.language.powershell"
@ -563,7 +630,7 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.constant.variable.powershell"
@ -578,7 +645,7 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.constant.automatic.powershell"
@ -593,7 +660,7 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "variable.language.powershell"
@ -608,13 +675,13 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "storage.modifier.scope.powershell"
},
"3": {
"name": "variable.other.normal.powershell"
"name": "variable.other.readwrite.powershell"
},
"4": {
"name": "entity.name.function.invocation.powershell"
@ -625,27 +692,30 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "storage.modifier.scope.powershell"
"name": "punctuation.section.braces.begin.powershell"
},
"3": {
"name": "variable.other.readwrite.powershell"
"name": "storage.modifier.scope.powershell"
},
"4": {
"name": "keyword.other.powershell"
"name": "variable.other.readwrite.powershell"
},
"5": {
"name": "punctuation.section.braces.end.powershell"
},
"6": {
"name": "entity.name.function.invocation.powershell"
}
},
"match": "(?i:(\\$\\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\\}))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
"match": "(?i:(\\$)(\\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\\}))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
},
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.variable.drive.powershell"
@ -662,22 +732,25 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.variable.drive.powershell"
"name": "punctuation.section.braces.begin.powershell"
},
"3": {
"name": "variable.other.readwrite.powershell"
"name": "support.variable.drive.powershell"
},
"4": {
"name": "keyword.other.powershell"
"name": "variable.other.readwrite.powershell"
},
"5": {
"name": "punctuation.section.braces.end.powershell"
},
"6": {
"name": "entity.name.function.invocation.powershell"
}
},
"match": "(?i:(\\$\\{)((?:\\p{L}|\\d|_)+:)?([^}]*[^}`])(\\}))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
"match": "(?i:(\\$)(\\{)((?:\\p{L}|\\d|_)+:)?([^}]*[^}`])(\\}))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
}
]
},
@ -723,7 +796,7 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "constant.language.powershell"
@ -735,7 +808,7 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.constant.variable.powershell"
@ -750,7 +823,7 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.variable.automatic.powershell"
@ -765,7 +838,7 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "variable.language.powershell"
@ -780,13 +853,13 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "storage.modifier.scope.powershell"
},
"3": {
"name": "variable.other.normal.powershell"
"name": "variable.other.readwrite.powershell"
},
"4": {
"name": "entity.name.function.invocation.powershell"
@ -797,7 +870,7 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "storage.modifier.scope.powershell"
@ -812,12 +885,12 @@
"name": "entity.name.function.invocation.powershell"
}
},
"match": "(?i:(\\$\\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\\}))"
"match": "(?i:(\\$)(\\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\\}))"
},
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.variable.drive.powershell"
@ -834,36 +907,39 @@
{
"captures": {
"1": {
"name": "keyword.other.powershell"
"name": "keyword.other.variable.definition.powershell"
},
"2": {
"name": "support.variable.drive.powershell"
"name": "punctuation.section.braces.begin"
},
"3": {
"name": "variable.other.readwrite.powershell"
"name": "support.variable.drive.powershell"
},
"4": {
"name": "keyword.other.powershell"
"name": "variable.other.readwrite.powershell"
},
"5": {
"name": "entity.name.function.invocation.powershell"
"name": "punctuation.section.braces.end"
}
},
"match": "(?i:(\\$\\{)((?:\\p{L}|\\d|_)+:)?([^}]*[^}`])(\\}))"
"match": "(?i:(\\$)(\\{)((?:\\p{L}|\\d|_)+:)?([^}]*[^}`])(\\}))"
}
]
},
"hashtable": {
"begin": "(@\\{)",
"begin": "(@)(\\{)",
"beginCaptures": {
"1": {
"name": "punctuation.section.braces.begin"
"name": "keyword.other.hashtable.begin.powershell"
},
"2": {
"name": "punctuation.section.braces.begin.powershell"
}
},
"end": "(\\})",
"endCaptures": {
"1": {
"name": "punctuation.section.braces.end"
"name": "punctuation.section.braces.end.powershell"
}
},
"name": "meta.hashtable.powershell",
@ -871,13 +947,13 @@
{
"captures": {
"1": {
"name": "punctuation.definition.string.begin"
"name": "punctuation.definition.string.begin.powershell"
},
"2": {
"name": "variable.other.readwrite.powershell"
},
"3": {
"name": "punctuation.definition.string.end"
"name": "punctuation.definition.string.end.powershell"
},
"4": {
"name": "keyword.operator.assignment.powershell"
@ -893,6 +969,32 @@
"include": "$self"
}
]
},
"doubleQuotedString": {
"begin": "(?<!(?<!`)\")\"",
"end": "\"(?!\")",
"name": "string.quoted.double.powershell",
"patterns": [
{
"match": "(?i)\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,64}\\b"
},
{
"include": "#variableNoProperty"
},
{
"include": "#variable"
},
{
"include": "#doubleQuotedStringEscapes"
},
{
"include": "#interpolation"
},
{
"match": "`\\s*$",
"name": "keyword.other.powershell"
}
]
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,25 +1,8 @@
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
[{
"name": "davidrios/jade-tmbundle",
"name": "davidrios/pug-tmbundle",
"version": "0.0.0",
"license": "MIT",
"repositoryURL": "https://github.com/davidrios/jade-tmbundle",
"description": "The file syntaxes/Jade.json was derived from Jade.tmLanguage in https://github.com/davidrios/jade-tmbundle.",
"licenseDetail": [
"The MIT License (MIT)",
"",
"Copyright (c) 2014 David Rios",
"",
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated ",
"documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to ",
"use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to ",
"whom the Software is furnished to do so, subject to the following conditions:",
"",
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
"",
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ",
"OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE ",
"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ",
"CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE"
]
"repositoryURL": "https://github.com/davidrios/pug-tmbundle",
"description": "The file syntaxes/pug.tmLanguage.json was derived from Syntaxes/Pug.JSON-tmLanguage in https://github.com/davidrios/pug-tmbundle."
}]

View file

@ -6,7 +6,7 @@
"publisher": "vscode",
"engines": { "vscode": "*" },
"scripts": {
"update-grammar": "node ../../build/npm/update-grammar.js davidrios/jade-tmbundle Syntaxes/Jade.tmLanguage ./syntaxes/pug.tmLanguage.json"
"update-grammar": "node ../../build/npm/update-grammar.js davidrios/pug-tmbundle Syntaxes/Pug.JSON-tmLanguage ./syntaxes/pug.tmLanguage.json"
},
"contributes": {
"languages": [{
@ -17,7 +17,7 @@
}],
"grammars": [{
"language": "jade",
"scopeName": "text.jade",
"scopeName": "text.pug",
"path": "./syntaxes/pug.tmLanguage.json"
}]
}

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
[
{
"c": ".ssdsd",
"t": "text.jade entity.other.attribute-name.class.jade",
"t": "text.pug entity.other.attribute-name.class.pug",
"r": {
"dark_plus": "entity.other.attribute-name: #9CDCFE",
"light_plus": "entity.other.attribute-name: #FF0000",
@ -12,12 +12,12 @@
},
{
"c": " // asdsdas",
"t": "text.jade string.comment.buffered.block.jade",
"t": "text.pug string.comment.buffered.block.pug",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string.comment.buffered.block.jade: #0000FF",
"light_plus": "string.comment.buffered.block.pug: #0000FF",
"dark_vs": "string: #CE9178",
"light_vs": "string.comment.buffered.block.jade: #0000FF",
"light_vs": "string.comment.buffered.block.pug: #0000FF",
"hc_black": "string: #CE9178"
}
}

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,6 @@
"description": "%description%",
"displayName": "%displayName%",
"version": "1.0.0",
"icon": "icon.png",
"author": "vscode",
"publisher": "vscode",
"license": "MIT",
@ -28,5 +27,16 @@
"*"
],
"main": "./out/extension",
"contributes": {}
"contributes": {
"configuration": {
"title": "Search (ripgrep)",
"properties": {
"searchrg.enable": {
"type": "boolean",
"default": false,
"scope": "window"
}
}
}
}
}

View file

@ -1,4 +1,4 @@
{
"displayName": "Search",
"description": "Provides search."
"displayName": "Search (ripgrep)",
"description": "Provides search using Ripgrep."
}

View file

@ -8,9 +8,11 @@ import { RipgrepTextSearchEngine } from './ripgrepTextSearch';
import { RipgrepFileSearchEngine } from './ripgrepFileSearch';
export function activate(): void {
const outputChannel = vscode.window.createOutputChannel('search-rg');
const provider = new RipgrepSearchProvider(outputChannel);
vscode.workspace.registerSearchProvider('file', provider);
if (vscode.workspace.getConfiguration('searchrg').get('enable')) {
const outputChannel = vscode.window.createOutputChannel('search-rg');
const provider = new RipgrepSearchProvider(outputChannel);
vscode.workspace.registerSearchProvider('file', provider);
}
}
class RipgrepSearchProvider implements vscode.SearchProvider {

View file

@ -4,12 +4,12 @@
*--------------------------------------------------------------------------------------------*/
import * as cp from 'child_process';
import * as path from 'path';
import { Readable } from 'stream';
import { NodeStringDecoder, StringDecoder } from 'string_decoder';
import * as vscode from 'vscode';
import { rgPath } from 'vscode-ripgrep';
import { normalizeNFC, normalizeNFD } from './normalization';
import { anchorGlob } from './ripgrepHelpers';
import { rgErrorMsgForDisplay } from './ripgrepTextSearch';
const isMac = process.platform === 'darwin';
@ -18,12 +18,16 @@ const isMac = process.platform === 'darwin';
const rgDiskPath = rgPath.replace(/\bnode_modules\.asar\b/, 'node_modules.asar.unpacked');
export class RipgrepFileSearchEngine {
private isDone = false;
private rgProc: cp.ChildProcess;
private killRgProcFn: (code?: number) => void;
constructor(private outputChannel: vscode.OutputChannel) {
this.killRgProcFn = () => this.rgProc && this.rgProc.kill();
process.once('exit', this.killRgProcFn);
}
private dispose() {
process.removeListener('exit', this.killRgProcFn);
}
provideFileSearchResults(options: vscode.SearchOptions, progress: vscode.Progress<string>, token: vscode.CancellationToken): Thenable<void> {
@ -37,7 +41,7 @@ export class RipgrepFileSearchEngine {
return new Promise((resolve, reject) => {
let isDone = false;
const cancel = () => {
this.isDone = true;
isDone = true;
this.rgProc.kill();
};
token.onCancellationRequested(cancel);
@ -52,7 +56,7 @@ export class RipgrepFileSearchEngine {
this.outputChannel.appendLine(`rg ${escapedArgs}\n - cwd: ${cwd}\n`);
this.rgProc = cp.spawn(rgDiskPath, rgArgs, { cwd });
process.once('exit', this.killRgProcFn);
this.rgProc.on('error', e => {
console.log(e);
reject(e);
@ -89,7 +93,6 @@ export class RipgrepFileSearchEngine {
});
if (last) {
process.removeListener('exit', this.killRgProcFn);
if (isDone) {
resolve();
} else {
@ -103,7 +106,12 @@ export class RipgrepFileSearchEngine {
}
}
});
});
}).then(
() => this.dispose(),
err => {
this.dispose();
return Promise.reject(err);
});
}
private collectStdout(cmd: cp.ChildProcess, cb: (err: Error, stdout?: string, last?: boolean) => void): void {
@ -162,7 +170,7 @@ function getRgArgs(options: vscode.FileSearchOptions): string[] {
const args = ['--files', '--hidden', '--case-sensitive'];
options.includes.forEach(globArg => {
const inclusion = anchor(globArg);
const inclusion = anchorGlob(globArg);
args.push('-g', inclusion);
if (isMac) {
const normalized = normalizeNFD(inclusion);
@ -173,7 +181,7 @@ function getRgArgs(options: vscode.FileSearchOptions): string[] {
});
options.excludes.forEach(globArg => {
const exclusion = `!${anchor(globArg)}`;
const exclusion = `!${anchorGlob(globArg)}`;
args.push('-g', exclusion);
if (isMac) {
const normalized = normalizeNFD(exclusion);
@ -202,7 +210,3 @@ function getRgArgs(options: vscode.FileSearchOptions): string[] {
return args;
}
function anchor(glob: string) {
return glob.startsWith('**') || glob.startsWith('/') ? glob : `/${glob}`;
}

View file

@ -16,8 +16,6 @@ export function fixDriveC(_path: string): string {
_path;
}
function trimTrailingSlash(str: string): string {
return str
.replace(/\/$/, '')
.replace(/\\$/, '');
export function anchorGlob(glob: string): string {
return glob.startsWith('**') || glob.startsWith('/') ? glob : `/${glob}`;
}

View file

@ -5,15 +5,14 @@
'use strict';
import * as vscode from 'vscode';
import { EventEmitter } from 'events';
import * as path from 'path';
import { StringDecoder, NodeStringDecoder } from 'string_decoder';
import * as cp from 'child_process';
import { EventEmitter } from 'events';
import { NodeStringDecoder, StringDecoder } from 'string_decoder';
import * as vscode from 'vscode';
import { rgPath } from 'vscode-ripgrep';
import { start } from 'repl';
import { anchorGlob } from './ripgrepHelpers';
// If vscode-ripgrep is in an .asar file, then the binary is unpacked.
const rgDiskPath = rgPath.replace(/\bnode_modules\.asar\b/, 'node_modules.asar.unpacked');
@ -55,17 +54,20 @@ export class RipgrepTextSearchEngine {
const escapedArgs = rgArgs
.map(arg => arg.match(/^-/) ? arg : `'${arg}'`)
.join(' ');
this.outputChannel.appendLine(`rg ${escapedArgs}\n - cwd: ${cwd}\n`);
this.outputChannel.appendLine(`rg ${escapedArgs}\n - cwd: ${cwd}`);
this.rgProc = cp.spawn(rgDiskPath, rgArgs, { cwd });
process.once('exit', this.killRgProcFn);
this.rgProc.on('error', e => {
console.log(e);
console.error(e);
this.outputChannel.append('Error: ' + (e && e.message));
reject(e);
});
let gotResult = false;
this.ripgrepParser = new RipgrepParser(MAX_TEXT_RESULTS, cwd);
this.ripgrepParser.on('result', (match: vscode.TextSearchResult) => {
gotResult = true;
progress.report(match);
});
@ -83,11 +85,14 @@ export class RipgrepTextSearchEngine {
let stderr = '';
this.rgProc.stderr.on('data', data => {
const message = data.toString();
this.outputChannel.appendLine(message);
this.outputChannel.append(message);
stderr += message;
});
this.rgProc.on('close', code => {
this.outputChannel.appendLine(gotData ? 'Got data from stdout' : 'No data from stdout');
this.outputChannel.appendLine(gotResult ? 'Got result from parser' : 'No result from parser');
this.outputChannel.appendLine('');
process.removeListener('exit', this.killRgProcFn);
if (this.isDone) {
resolve();
@ -308,11 +313,12 @@ function getRgArgs(query: vscode.TextSearchQuery, options: vscode.TextSearchOpti
const args = ['--hidden', '--heading', '--line-number', '--color', 'ansi', '--colors', 'path:none', '--colors', 'line:none', '--colors', 'match:fg:red', '--colors', 'match:style:nobold'];
args.push(query.isCaseSensitive ? '--case-sensitive' : '--ignore-case');
// TODO@roblou
options.includes
.map(anchorGlob)
.forEach(globArg => args.push('-g', globArg));
options.excludes
.map(anchorGlob)
.forEach(rgGlob => args.push('-g', `!${rgGlob}`));
if (options.maxFileSize) {
@ -347,12 +353,18 @@ function getRgArgs(query: vscode.TextSearchQuery, options: vscode.TextSearchOpti
const regexpStr = regexp.source.replace(/\\\//g, '/'); // RegExp.source arbitrarily returns escaped slashes. Search and destroy.
args.push('--regexp', regexpStr);
} else if (query.isRegExp) {
args.push('--regexp', query.pattern);
const rgRegexPattern = query.pattern.endsWith('$') ?
query.pattern.replace(/\$$/, '\\r?') :
query.pattern;
args.push('--regexp', rgRegexPattern);
} else {
searchPatternAfterDoubleDashes = query.pattern;
args.push('--fixed-strings');
}
args.push('--no-config');
// Folder to search
args.push('--');

View file

@ -365,7 +365,6 @@
// Workbench: Editors
// "editorGroupHeader.noTabsBackground": "",
"editorGroup.border": "#2b2b4a",
"editorGroup.background": "#1c1c2a",
"editorGroup.dropBackground": "#25375daa",
"editorGroupHeader.tabsBackground": "#1c1c2a",

View file

@ -216,9 +216,9 @@
},
{
"scope": [
"string.comment.buffered.block.jade",
"string.quoted.jade",
"string.interpolated.jade",
"string.comment.buffered.block.pug",
"string.quoted.pug",
"string.interpolated.pug",
"string.unquoted.plain.in.yaml",
"string.unquoted.plain.out.yaml",
"string.unquoted.block.yaml",

Some files were not shown because too many files have changed in this diff Show more