bring titlebarplus up to date

* Merge NPM Scripts: Added configuration option to change default click action #49282

* fix #50560

* Fix getmac test (#48804)

* Cleaning up some typos in vscode.d.ts and vscode.proposed.d.ts (#50533)

* yarn.lock changes

* grid - log serialized state if restoring failed

* Fixes #50382: Align .mtku with .detected-link

* debug issues back to isidorn

* Hide interactive playground commands from command palette (fixes #49706)

* grid - drop outline as focus indication and rely on dimmed state

* grid - allow to close empty group when closing all editors of a group

* grid - get preferredSize from grid

* Fixes #43003: Cannot specify a global problemMatcher in tasks.json

* cleanup integrated terminal support for debugging

* grid - action wording tweaks

* #45663 Use core translations asset

* grid - allow to close dirty diff editor if master is still opened in same group

* Support to run npm install from a package node

* grid - log previous UI state upon error

* grid - stronger border top color

otherwise when a tab is showing in a vertical split, the border collides with the sash border

* remove todo

* do not append logLevel

#47774

* Implement Go To Next/Previous Breakpoint editor actions

* Include enabledOnly in debug model interface

* remove from schema

#47774

* #45663 fix compilations

* change openBreakpointSource to use IBreakpoint

* return passed context if resourceOrContext is not useful

* fix off by one issue

* Simplify implementation

* return context if it has a groupId

* polish

* Fixes Microsoft/monaco-editor#891: Focus editor when returning from context menu

* go to next / previosu breakpoint minor polish

* Add Endgame for 1.24

* fix index computing for editor close case

* Fix #49145

- Enable/Disable viewlets by views when context
- Move viewlet enablement/disablement to views service
- Fix - adopt if a viewlet extension is disabled/removed

* Avoid command palette entry (#49340)

* [handlebars] code-folding algorithm is less useful than Indentation-based one. Fixes #48457

* use upper lang id

* Fixes #49378

* #49145 Store placeholder states for all viewlets

* Add `logicalLine` argument to `mutlicursor.insertBelow` and `mutlicursor.insertAbove`

* Removed duplicate loop

* eliminate code duplication; use resolveWorkspaceFolder()

* #45663 Get all asset types

* [css] update service

* [html] update services

* grid - fix compile

* add User-Id to marketplace build requests

* Improve rendererType description

Fixes #50617

* fix #50672

* Fixes #49173

* fix #50321

* fix #50670

* Install option not needed when we have Install and Restart Fixes #50669

* Fixes #50616, Showing/hiding details in Issue Reporter resets scroll position

* Fix #50642, fix #50673

* Issue reporter and process explorer windows should close when the parent window closes, fixes #50716

* Issue Reporter should clear the error state when selecting an extension, fixes #50702

* Extracting methods

* Make sure we update the webview's state on setState

* Avoid prompting for same file type in the same session #50537

* Use language name instead of locale in the prompt #50738

* Use correct failed error code for webview resource load error

* Mark unused parameter

* Restore restart

* Try serializing webviews even if they have not called setState

Fixes #50752

* Change parameter name to match interface name

Fixes #50745

* Fix non-serializable webviews being revived if they called setState

* Include recommended extensions in telemetry events to determine success

* Fix #49777 - Emmet balance In after balance out should go back to initial selection and not first child (#49996)

* Update Emmet - balance.ts

* Cover all cases

* Update prompt msg Fixes #50738

* Fix #50632

* search-rg has no icon

* EH search - replace search.enableSearchProviders with a search-rg specific setting

* fix #50742

* fix #50691

* part of #50760

* smoke: uncomment debug suite

* smoketest: use yarn

* grid - allow to close empty groups via middle click (#50733)

* careful with path comparisons on windows

related to #50760

* smoke: run yarn verbose

* fix #50710

* Improve description (#43208)

* fix #50722

* Fix #50663

* Fix #47586

* fixes #50609

* fixes #50026

* 💄

* fix  #50773

* improve perf of findId and getElementById, #50575

* don't show outline when there are more then 7500 symbols, #50575

* fix typos

* polish for #50667

* fix #50700

* grid keep sizing after branch node demotion

fixes #50564

* grid - for now remove editorGroup.activeEmptyBackground

* fix #50726

* grid: resize views when branch is demoted

fixes #50675

* fix #50727

* fix #50734

* remove preview rant from search.location

* splitview: dont propagate white-sapce property

fixes #50720

* fix #50774

* Fixes #50296

* fix  #50207

* Fixes #24670: Add API to determine if the task service supports parallel task execution.

* fix #50741

* Fixes  #49400: Cannot read property 'then' of undefined

* Fix #50717

* Fix #48901

* polish debug.toolBarLocation

fixes #50786

* Fix #50717

* missing compilation

* Fix #48225

* fix #50711

* Fix errors installing extension from Welcome page (fixes #50753)

* fixes #50794

* fixes #50787

* continuous build: use vsts npm feed

* Fix for #50792: empty pre post scripts not rendered properly

* Fix #50728

* continuous build: use vsts feed

* Fix for #50792 npm exclude doesn´t work for folder names

* Move previewOptions, #50788

* build: remove npm auth

* better fix for #50710

* Revert "Merge pull request #49790 from usernamehw/raw_settings"

This reverts commit f92a162b41, reversing
changes made to fc710af792.

* Remove unused variable

* Fix regression in C# TextMate grammar related to lambda parameters

This tweak fixes a regression recently introduced in the C# TextMate grammar around
implicitly-typed lambda parameters.

* https://github.com/dotnet/csharp-tmLanguage/issues/119
* https://github.com/dotnet/csharp-tmLanguage/issues/120

* Fix parameter not being escaped

Fixes #49057

* wip: grid.getNeighborViews

* Make sure we use normalized path for compare

Fixes #50760

(the path should already have been normalized at this point so I don't think there is any user impact)

* Clean up importModuleSpecifier wording

Fixes #50817

* Remove duplicate strings and small cleanup

* Spelling fix Ouoting -> Quoting

* Restore default settings editor keybinding

* Dont trigger emmet for # in selectors Fixes #49269

* Hide settings editor feedback button in stable

* Use better colors for markdown code blocks

* Moving webview api back to proposed for more polishing

#49022

* Shorten showUnused setting name

Fixes #50648

* fix #50678

* Don't include imports in js/ts document symbol results

Fixes #50829

* smoketest: remove verbose from yarn

* smoketest: clear state from failing search tests

* minor rename

* Fix markdown preview not setting context properly on first creation

Fixes #50558

* smoketest: update to package-lock.json

fixes #50857

* smoketest: bring back search tests

* #48901 Expand by default only in custom viewlets

* fixes #50812

* open editors: clear focus when group without editors is active

fixes #50563

* Fix MaxNumber incrementFileName bug

* Fixes #48758: Do not import standalone editor modules

* fixes #50864

* Use `MAX_SAFE_SMALL_INTEGER`

* Fixes #50858: Task api is still marked as proposed

* fixes #50737

* fix #50867

* Fix: showQuickPick keeps showing infinite progress (fixes #50863)

* Clarify for translation (fixes #50634)

* fixes #50870

* fix #50479

* grid - todo@grid => todo@ben

* grid - adopt new getNeighborViews() method

* grid - add workbench.action.closeEditorsAndGroup

* open editors: close group action

fixes #50625

* open editors: use actionRunner for contexts

fixes #50621

* [css][html] update service

* grid: getNeighborViews

* grid - adopt wrapping

* Some menu action clients (ActionBar) handle alternative actions on their own so the alternative actions should be ignored

fixes #50581

* fillInActionBarActions and fillInContextMenuActions for clarity

* Remove inconsistent use of active in terminal API

Related #48434

* Try using fixAllDescription for js/ts quick fixes

Fixes #42549

* Fixes #50828, code-insiders --status triggered exception in main process

* Pick up ts 2.9.1 final

* Fix for #50868 and #50884

* Still gray out vars even if user has disabled suggestions

Fixes #50890

* grid: fix neighbor npe issue

* grid: more getNeighborViews tests

* grid: use boundaries for neighbor finding

* grid: getNeighborViews perf

* grid: add todo

* 2018-05-31. Merged in translations from Transifex.

* Update GDPR annotation

* update message

* Add specific `refactor.move` scope for js/ts move to new file action

* Use localized language name when available

* Add proper contribution schema for ts server pluguins

#50682

* Fix extra word

* Fix #50909 - add link to new settings editor from old one

* Left-align settings editor preview prompt

* grid - fix issues with touchbar updating

* grid - use viewColumnToEditorGroup in more places

* grid - close all groups should preserve first group

* Reapply fix for #50790

* grid - assign some default keybindings for focus group

* Fixes #50763: All running Visual Studio code instances shutdown all at once

* grid - 💄

* fixes #50926

* show alternative actions when alt is pressed, not only on mouse over

* open editors: click on groups should activate them

* update description (for #50677)

* Fix #50835

* grid - tweak some groups access order

* one more time, fix #50321

* beware of keybinding command null arguments

fixes #50821

* grid - prevent multiple confirmation dialogs for the same editor to show up (for  #50539)

* smoketest: go-to-definition is flaky

fixes #50944
fixes #49107

* Fixes #50943: TSC version 2.9.x in watch mode prints different end compile message

* grid - fix bad === for editors

* 💄 grid, cleanup getViews()

* Update distro commit and third party notices

* Use localizedLanguageName instead of languageNameLocalized which doesnt exist

* Remove now unneeded any

* Make sure unused diags are still updated when suggestions are disabled

Fixes #50890

* Fix unused var

* Update version

* Update issue templates, #49380

* Fix #50893 - escape regex chars when copy search string from editor

* Fix #50985 - don't take editor text when toggling search details
This commit is contained in:
Benjamin Pasero
2018-06-04 10:44:46 -07:00
committed by SteVen Batten
parent fc07fa2e2b
commit 06df95754d
1447 changed files with 32028 additions and 22542 deletions
@@ -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:
@@ -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
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.
+1
View File
@@ -19,4 +19,5 @@
'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',
}
+1 -1
View File
@@ -47,7 +47,7 @@
assignLabel: false
},
file-explorer: {
assignees: [ isidorn ],
assignees: [ weinand ],
assignLabel: false
},
format: [],
+1 -1
View File
@@ -18,7 +18,7 @@
"name": "Attach to Extension Host",
"protocol": "inspector",
"port": 5870,
// "restart": true,
"restart": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
]
+1 -3
View File
@@ -41,8 +41,6 @@
"npm.exclude": "**/extensions/**",
"emmet.excludeLanguages": [],
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single"
// Self-host search in EH
"search.enableSearchProviders": true
}
+171
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."
]
}
]
+18 -13
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
=========================================
+2 -2
View File
@@ -1,12 +1,12 @@
[
{
"name": "ms-vscode.node-debug",
"version": "1.23.3",
"version": "1.24.0",
"repo": "https://github.com/Microsoft/vscode-node-debug"
},
{
"name": "ms-vscode.node-debug2",
"version": "1.24.1",
"version": "1.24.2",
"repo": "https://github.com/Microsoft/vscode-node-debug2"
}
]
+1 -1
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/*'
];
+1 -1
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: [{
+1
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;
+1
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 {
@@ -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));
@@ -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`));
}
}
}
+4
View File
@@ -32,6 +32,10 @@ declare namespace monaco {
Error = 3,
}
export enum MarkerTag {
Unnecessary = 1,
}
export enum MarkerSeverity {
Hint = 1,
Info = 2,
+1 -1
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));
+21 -9
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
@@ -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
}));
}
@@ -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"
@@ -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"
@@ -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",
@@ -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);
});
@@ -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"
+23 -23
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"
+4 -1
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
+37 -2
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;
}
@@ -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;';
@@ -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) {
@@ -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 */{
});
});
});
+10 -2
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();
@@ -1522,6 +1528,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 +1745,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;
}
+2 -2
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;
+10
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;
}
@@ -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)
@@ -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": {
@@ -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"
},
@@ -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);
}
@@ -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 {
@@ -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"
+20 -20
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"
@@ -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"
},
@@ -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"
},
@@ -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": {
@@ -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"
},
@@ -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 });
}
@@ -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"
+20 -20
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"
+1 -1
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",
@@ -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": {
@@ -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;
}
@@ -163,7 +163,8 @@ table > tbody > tr + tr > td {
blockquote {
margin: 0 7px 0 5px;
padding: 0 16px 0 10px;
border-left: 5px solid;
border-left-width: 5px;
border-left-style: solid;
}
code {
@@ -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;
}
@@ -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"
@@ -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));
@@ -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 = [
@@ -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);
}
@@ -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 {
@@ -49,7 +50,7 @@ export class MarkdownEngine {
return `<pre class="hljs"><code><div>${this.md!.utils.escapeHtml(str)}</div></code></pre>`;
}
}).use(mdnh, {
slugify: (header: string) => Slug.fromHeading(header).value
slugify: (header: string) => this.slugifier.fromHeading(header).value
});
for (const plugin of this.extensionPreviewResourceProvider.markdownItPlugins) {
@@ -145,13 +146,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) {
@@ -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);
}
};
@@ -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,
@@ -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);
}
@@ -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);
});
});
+2 -1
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`.
+37 -5
View File
@@ -53,12 +53,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 +88,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 +105,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 +173,16 @@
"default": false,
"scope": "resource",
"description": "%config.npm.enableScriptExplorer%"
},
"npm.scriptExplorerAction": {
"type": "string",
"enum": [
"open",
"run"
],
"description": "%config.npm.scriptExplorerAction%",
"scope": "window",
"default": "open"
}
}
},
+3 -1
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"
}
+7
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

+7
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

@@ -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) {
+13 -2
View File
@@ -15,10 +15,21 @@ let taskProvider: vscode.Disposable | undefined;
export async function activate(context: vscode.ExtensionContext): Promise<void> {
taskProvider = registerTaskProvider(context);
registerExplorer(context);
const treeDataProvider = registerExplorer(context);
configureHttpRequest();
vscode.workspace.onDidChangeConfiguration(() => {
vscode.workspace.onDidChangeConfiguration((e) => {
configureHttpRequest();
if (e.affectsConfiguration('npm.exclude')) {
invalidateScriptsCache();
if (treeDataProvider) {
treeDataProvider.refresh();
}
}
if (e.affectsConfiguration('npm.scriptExplorerAction')) {
if (treeDataProvider) {
treeDataProvider.refresh();
}
}
});
context.subscriptions.push(addJSONProviders(httpRequest.xhr));
}
+40 -7
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) {
+13 -4
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);
+1 -1
View File
@@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "Dependencies shared by all extensions",
"dependencies": {
"typescript": "2.9.0-insiders.20180510"
"typescript": "2.9.1"
},
"scripts": {
"postinstall": "node ./postinstall"
@@ -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
+3 -20
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."
}]
+2 -2
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
@@ -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
+12 -2
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"
}
}
}
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
{
"displayName": "Search",
"description": "Provides search."
"displayName": "Search (ripgrep)",
"description": "Provides search using Ripgrep."
}
+6 -4
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 {
@@ -22,7 +24,7 @@ class RipgrepSearchProvider implements vscode.SearchProvider {
return engine.provideTextSearchResults(query, options, progress, token);
}
provideFileSearchResults(options: vscode.SearchOptions, progress: vscode.Progress<vscode.Uri>, token: vscode.CancellationToken): Thenable<void> {
provideFileSearchResults(options: vscode.SearchOptions, progress: vscode.Progress<string>, token: vscode.CancellationToken): Thenable<void> {
const engine = new RipgrepFileSearchEngine(this.outputChannel);
return engine.provideFileSearchResults(options, progress, token);
}
+18 -14
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,15 +18,19 @@ 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);
}
provideFileSearchResults(options: vscode.SearchOptions, progress: vscode.Progress<vscode.Uri>, token: vscode.CancellationToken): Thenable<void> {
private dispose() {
process.removeListener('exit', this.killRgProcFn);
}
provideFileSearchResults(options: vscode.SearchOptions, progress: vscode.Progress<string>, token: vscode.CancellationToken): Thenable<void> {
this.outputChannel.appendLine(`provideFileSearchResults ${JSON.stringify({
...options,
...{
@@ -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);
@@ -85,11 +89,10 @@ export class RipgrepFileSearchEngine {
}
relativeFiles.forEach(relativeFile => {
progress.report(vscode.Uri.file(path.join(cwd, relativeFile)));
progress.report(relativeFile);
});
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}`;
}
+2 -4
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}`;
}
+55 -49
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();
// onMessage({ 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();
@@ -136,12 +141,13 @@ export function rgErrorMsgForDisplay(msg: string): string | undefined {
export class RipgrepParser extends EventEmitter {
private static readonly RESULT_REGEX = /^\u001b\[0m(\d+)\u001b\[0m:(.*)(\r?)/;
private static readonly FILE_REGEX = /^\u001b\[0m(.+)\u001b\[0m$/;
private static readonly ESC_CODE = '\u001b'.charCodeAt(0);
private static readonly MATCH_START_CHAR = '\u001b';
// public for test
public static readonly MATCH_START_MARKER = '\u001b[0m\u001b[31m';
public static readonly MATCH_END_MARKER = '\u001b[0m';
private currentFile: vscode.Uri;
private currentFile: string;
private remainder: string;
private isDone: boolean;
private stringDecoder: NodeStringDecoder;
@@ -195,21 +201,13 @@ export class RipgrepParser extends EventEmitter {
// Line is a result - add to collected results for the current file path
this.handleMatchLine(outputLine, lineNum, matchText);
} else if (r = outputLine.match(RipgrepParser.FILE_REGEX)) {
this.currentFile = this.getFileUri(r[1]);
this.currentFile = r[1];
} else {
// Line is empty (or malformed)
}
}
}
private getFileUri(relativeOrAbsolutePath: string): vscode.Uri {
const absPath = path.isAbsolute(relativeOrAbsolutePath) ?
relativeOrAbsolutePath :
path.join(this.rootFolder, relativeOrAbsolutePath);
return vscode.Uri.file(absPath);
}
private handleMatchLine(outputLine: string, lineNum: number, lineText: string): void {
if (lineNum === 0) {
lineText = stripUTF8BOM(lineText);
@@ -238,37 +236,44 @@ export class RipgrepParser extends EventEmitter {
const lineMatches: vscode.Range[] = [];
for (let i = 0; i < lineText.length - (RipgrepParser.MATCH_END_MARKER.length - 1);) {
if (lineText.substr(i, RipgrepParser.MATCH_START_MARKER.length) === RipgrepParser.MATCH_START_MARKER) {
// Match start
const chunk = lineText.slice(lastMatchEndPos, i);
realTextParts.push(chunk);
i += RipgrepParser.MATCH_START_MARKER.length;
matchTextStartPos = i;
matchTextStartRealIdx = textRealIdx;
} else if (lineText.substr(i, RipgrepParser.MATCH_END_MARKER.length) === RipgrepParser.MATCH_END_MARKER) {
// Match end
const chunk = lineText.slice(matchTextStartPos, i);
realTextParts.push(chunk);
if (!hitLimit) {
const startCol = matchTextStartRealIdx;
const endCol = textRealIdx;
if (lineText.charCodeAt(i) === RipgrepParser.ESC_CODE) {
if (lineText.substr(i, RipgrepParser.MATCH_START_MARKER.length) === RipgrepParser.MATCH_START_MARKER) {
// Match start
const chunk = lineText.slice(lastMatchEndPos, i);
realTextParts.push(chunk);
i += RipgrepParser.MATCH_START_MARKER.length;
matchTextStartPos = i;
matchTextStartRealIdx = textRealIdx;
} else if (lineText.substr(i, RipgrepParser.MATCH_END_MARKER.length) === RipgrepParser.MATCH_END_MARKER) {
// Match end
const chunk = lineText.slice(matchTextStartPos, i);
realTextParts.push(chunk);
if (!hitLimit) {
const startCol = matchTextStartRealIdx;
const endCol = textRealIdx;
// actually have to finish parsing the line, and use the real ones
lineMatches.push(new vscode.Range(lineNum, startCol, lineNum, endCol));
}
// actually have to finish parsing the line, and use the real ones
lineMatches.push(new vscode.Range(lineNum, startCol, lineNum, endCol));
}
matchTextStartPos = -1;
matchTextStartRealIdx = -1;
i += RipgrepParser.MATCH_END_MARKER.length;
lastMatchEndPos = i;
this.numResults++;
matchTextStartPos = -1;
matchTextStartRealIdx = -1;
i += RipgrepParser.MATCH_END_MARKER.length;
lastMatchEndPos = i;
this.numResults++;
// Check hit maxResults limit
if (this.numResults >= this.maxResults) {
// Finish the line, then report the result below
hitLimit = true;
// Check hit maxResults limit
if (this.numResults >= this.maxResults) {
// Finish the line, then report the result below
hitLimit = true;
}
} else {
// ESC char in file
i++;
textRealIdx++;
}
} else {
// Some other char
i++;
textRealIdx++;
}
@@ -283,7 +288,7 @@ export class RipgrepParser extends EventEmitter {
lineMatches
.map(range => {
return <vscode.TextSearchResult>{
uri: this.currentFile,
path: this.currentFile,
range,
preview: {
text: preview,
@@ -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) {
@@ -365,7 +365,6 @@
// Workbench: Editors
// "editorGroupHeader.noTabsBackground": "",
"editorGroup.border": "#2b2b4a",
"editorGroup.background": "#1c1c2a",
"editorGroup.dropBackground": "#25375daa",
"editorGroupHeader.tabsBackground": "#1c1c2a",
@@ -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",
@@ -19,7 +19,6 @@
"editorWidget.background": "#131510",
"editorHoverWidget.background": "#221a14",
"editorGroupHeader.tabsBackground": "#131510",
"editorGroup.background": "#0f0c08",
"editorLineNumber.activeForeground": "#adadad",
"tab.inactiveBackground": "#131510",
"titleBar.activeBackground": "#423523",
@@ -21,7 +21,6 @@
"editorIndentGuide.background": "#505037",
"editorIndentGuide.activeBackground": "#707057",
"editorGroupHeader.tabsBackground": "#282828",
"editorGroup.background": "#1e1e1e",
"tab.inactiveBackground": "#404040",
"tab.border": "#303030",
"tab.inactiveForeground": "#d8d8d8",
@@ -416,4 +416,4 @@
}
}
]
}
}
@@ -15,7 +15,6 @@
// editor
"editor.background": "#390000",
"editorGroup.border": "#ff666633",
"editorGroup.background": "#1c0101",
"editorCursor.foreground": "#970000",
"editor.foreground": "#F8F8F8",
"editorWhitespace.foreground": "#c10000",
@@ -413,7 +413,6 @@
// Workbench: Editors
// "editorGroupHeader.noTabsBackground": "",
"editorGroup.border": "#00212B",
"editorGroup.background": "#011b23",
"editorGroup.dropBackground": "#2AA19844",
"editorGroupHeader.tabsBackground": "#004052",
@@ -409,7 +409,6 @@
// Workbench: Editors
// "editorGroupHeader.noTabsBackground": "",
"editorGroup.border": "#DDD6C1",
"editorGroup.background": "#FFFBF2",
"editorGroup.dropBackground": "#DDD6C1AA",
"editorGroupHeader.tabsBackground": "#D9D2C2",
@@ -23,7 +23,6 @@
"editorHoverWidget.border": "#ffffff44",
"editorGroup.border": "#404f7d",
"editorGroupHeader.tabsBackground": "#001733",
"editorGroup.background": "#1c1c2a",
"editorGroup.dropBackground": "#25375daa",
"peekViewResult.background": "#001c40",
"tab.inactiveBackground": "#001c40",
@@ -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": "TypeScript",
"scopeName": "source.ts",
"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.ts"
},
"2": {
"name": "punctuation.separator.label.ts"
}
},
"end": "(?<=\\{)",
"patterns": [
{
"include": "#decl-block"
}
]
},
{
"match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(:)",
"captures": {
"1": {
"name": "entity.name.label.ts"
},
"2": {
"name": "punctuation.separator.label.ts"
}
}
}
]
},
"expression": {
"patterns": [
{
@@ -1387,9 +1422,6 @@
}
},
"patterns": [
{
"include": "#string"
},
{
"include": "#comment"
},
@@ -1405,6 +1437,9 @@
{
"include": "#field-declaration"
},
{
"include": "#string"
},
{
"include": "#type-annotation"
},
@@ -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": "TypeScriptReact",
"scopeName": "source.tsx",
"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.tsx"
},
"2": {
"name": "punctuation.separator.label.tsx"
}
},
"end": "(?<=\\{)",
"patterns": [
{
"include": "#decl-block"
}
]
},
{
"match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(:)",
"captures": {
"1": {
"name": "entity.name.label.tsx"
},
"2": {
"name": "punctuation.separator.label.tsx"
}
}
}
]
},
"expression": {
"patterns": [
{
@@ -1390,9 +1425,6 @@
}
},
"patterns": [
{
"include": "#string"
},
{
"include": "#comment"
},
@@ -1408,6 +1440,9 @@
{
"include": "#field-declaration"
},
{
"include": "#string"
},
{
"include": "#type-annotation"
},
@@ -44,6 +44,12 @@
],
"main": "./out/extension",
"contributes": {
"jsonValidation": [
{
"fileMatch": "package.json",
"url": "./schemas/package.schema.json"
}
],
"configuration": {
"type": "object",
"title": "%configuration.typescript%",
@@ -471,16 +477,38 @@
"description": "%typescript.preferences.importModuleSpecifier%",
"scope": "resource"
},
"javascript.showUnused.enabled": {
"javascript.showUnused": {
"type": "boolean",
"default": true,
"description": "%typescript.showUnused.enabled%",
"description": "%typescript.showUnused%",
"scope": "resource"
},
"typescript.showUnused.enabled": {
"typescript.showUnused": {
"type": "boolean",
"default": true,
"description": "%typescript.showUnused.enabled%",
"description": "%typescript.showUnused%",
"scope": "resource"
},
"typescript.updateImportsOnFileMove.enabled": {
"type": "string",
"enum": [
"prompt",
"always",
"never"
],
"default": "prompt",
"description": "%typescript.updateImportsOnFileMove.enabled%",
"scope": "resource"
},
"javascript.updateImportsOnFileMove.enabled": {
"type": "string",
"enum": [
"prompt",
"always",
"never"
],
"default": "prompt",
"description": "%typescript.updateImportsOnFileMove.enabled%",
"scope": "resource"
}
}
@@ -488,12 +516,12 @@
"commands": [
{
"command": "typescript.reloadProjects",
"title": "%typescript.reloadProjects.title%",
"title": "%reloadProjects.title%",
"category": "TypeScript"
},
{
"command": "javascript.reloadProjects",
"title": "%javascript.reloadProjects.title%",
"title": "%reloadProjects.title%",
"category": "JavaScript"
},
{
@@ -503,12 +531,12 @@
},
{
"command": "typescript.goToProjectConfig",
"title": "%typescript.goToProjectConfig.title%",
"title": "%goToProjectConfig.title%",
"category": "TypeScript"
},
{
"command": "javascript.goToProjectConfig",
"title": "%javascript.goToProjectConfig.title%",
"title": "%goToProjectConfig.title%",
"category": "JavaScript"
},
{
@@ -637,7 +665,7 @@
"regexp": "^\\s*(?:message TS6032:|\\[?\\d{1,2}:\\d{1,2}:\\d{1,2}(?: AM| PM| a\\.m\\.| p\\.m\\.)?(?:\\]| -)) File change detected\\. Starting incremental compilation\\.\\.\\."
},
"endsPattern": {
"regexp": "^\\s*(?:message TS6042:|\\[?\\d{1,2}:\\d{1,2}:\\d{1,2}(?: AM| PM| a\\.m\\.| p\\.m\\.)?(?:\\]| -)) Compilation complete\\. Watching for file changes\\."
"regexp": "^\\s*(?:message TS6042:|\\[?\\d{1,2}:\\d{1,2}:\\d{1,2}(?: AM| PM| a\\.m\\.| p\\.m\\.)?(?:\\]| -)) (?:Compilation complete\\.|Found \\d+ errors?\\.) Watching for file changes\\."
}
}
}
@@ -1,8 +1,7 @@
{
"displayName": "TypeScript and JavaScript Language Features",
"description": "Provides rich language support for JavaScript and TypeScript.",
"typescript.reloadProjects.title": "Reload Project",
"javascript.reloadProjects.title": "Reload Project",
"reloadProjects.title": "Reload Project",
"configuration.typescript": "TypeScript",
"typescript.useCodeSnippetsOnMethodSuggest.dec": "Complete functions with their parameter signature.",
"typescript.tsdk.desc": "Specifies the folder path containing the tsserver and lib*.d.ts files to use.",
@@ -30,8 +29,7 @@
"format.placeOpenBraceOnNewLineForFunctions": "Defines whether an open brace is put onto a new line for functions or not.",
"format.placeOpenBraceOnNewLineForControlBlocks": "Defines whether an open brace is put onto a new line for control blocks or not.",
"javascript.validate.enable": "Enable/disable JavaScript validation.",
"typescript.goToProjectConfig.title": "Go to Project Configuration",
"javascript.goToProjectConfig.title": "Go to Project Configuration",
"goToProjectConfig.title": "Go to Project Configuration",
"javascript.referencesCodeLens.enabled": "Enable/disable references CodeLens in JavaScript files.",
"typescript.referencesCodeLens.enabled": "Enable/disable references CodeLens in TypeScript files. Requires TypeScript >= 2.0.6.",
"typescript.implementationsCodeLens.enabled": "Enable/disable implementations CodeLens. Requires TypeScript >= 2.2.0.",
@@ -40,7 +38,7 @@
"typescript.selectTypeScriptVersion.title": "Select TypeScript Version",
"typescript.reportStyleChecksAsWarnings": "Report style checks as warnings",
"jsDocCompletion.enabled": "Enable/disable auto JSDoc comments",
"javascript.implicitProjectConfig.checkJs": "Enable/disable semantic checking of JavaScript files. Existing jsconfig.json or tsconfig.json files override this setting. Requires TypeScript >=2.3.1.",
"javascript.implicitProjectConfig.checkJs": "Enable/disable semantic checking of JavaScript files. Existing jsconfig.json or tsconfig.json files override this setting. Requires TypeScript >= 2.3.1.",
"typescript.npm": "Specifies the path to the NPM executable used for Automatic Type Acquisition. Requires TypeScript >= 2.3.4.",
"typescript.check.npmIsInstalled": "Check if NPM is installed for Automatic Type Acquisition.",
"javascript.nameSuggestions": "Enable/disable including unique names from the file in JavaScript suggestion lists.",
@@ -48,14 +46,15 @@
"typescript.problemMatchers.tsc.label": "TypeScript problems",
"typescript.problemMatchers.tscWatch.label": "TypeScript problems (watch mode)",
"typescript.quickSuggestionsForPaths": "Enable/disable quick suggestions when typing out an import path.",
"typescript.locale": "Sets the locale used to report TypeScript errors. Requires TypeScript >= 2.6.0. Default of 'null' uses VS Code's locale for TypeScript errors.",
"javascript.implicitProjectConfig.experimentalDecorators": "Enable/disable 'experimentalDecorators' for JavaScript files that are not part of a project. Existing jsconfig.json or tsconfig.json files override this setting. Requires TypeScript >=2.3.1.",
"typescript.locale": "Sets the locale used to report JavaScript and TypeScript errors. Requires TypeScript >= 2.6.0. Default of 'null' uses VS Code's locale.",
"javascript.implicitProjectConfig.experimentalDecorators": "Enable/disable 'experimentalDecorators' for JavaScript files that are not part of a project. Existing jsconfig.json or tsconfig.json files override this setting. Requires TypeScript >= 2.3.1.",
"typescript.autoImportSuggestions.enabled": "Enable/disable auto import suggestions. Requires TypeScript >= 2.6.1",
"typescript.experimental.syntaxFolding": "Enables/disables syntax aware folding markers.",
"taskDefinition.tsconfig.description": "The tsconfig file that defines the TS build.",
"javascript.suggestionActions.enabled": "Enable/disable suggestion diagnostics for JavaScript files in the editor. Requires TypeScript >= 2.8",
"typescript.suggestionActions.enabled": "Enable/disable suggestion diagnostics for TypeScript files in the editor. Requires TypeScript >= 2.8",
"typescript.preferences.quoteStyle": "Preferred quote style to use for quick fixes: 'single' quotes, 'double' quotes, or 'auto' infer quote type from existing imports. Requires TS >= 2.9",
"typescript.preferences.importModuleSpecifier": "Preferred path style for auto imports: 'relative' paths, 'non-relative' paths, or 'auto' infer the shortest path type. Requires TS >= 2.9",
"typescript.showUnused.enabled": "Enable/disable highlighting of unused variables in code. Requires TypeScript >= 2.9"
"typescript.preferences.quoteStyle": "Preferred quote style to use for quick fixes: 'single' quotes, 'double' quotes, or 'auto' infer quote type from existing imports. Requires TypeScript >= 2.9",
"typescript.preferences.importModuleSpecifier": "Preferred path style for auto imports:\n- \"relative\" to the file location.\n- \"non-relative\" based on the 'baseUrl' configured in your 'jsconfig.json' / 'tsconfig.json'.\n- \"auto\" infer the shortest path type.\nRequires TypeScript >= 2.9",
"typescript.showUnused": "Enable/disable highlighting of unused variables in code. Requires TypeScript >= 2.9",
"typescript.updateImportsOnFileMove.enabled": "Enable/disable automatic updating of import paths when you rename or move a file in VS Code. Possible values are: 'prompt' on each rename, 'always' update paths automatically, and 'never' rename paths and don't prompt me. Requires TypeScript >= 2.9"
}
@@ -0,0 +1,26 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "TypeScript contributions to package.json",
"type": "object",
"properties": {
"contributes": {
"type": "object",
"properties": {
"typescriptServerPlugins": {
"type": "array",
"description": "Contributed TypeScript server plugins.",
"items": {
"type": "object",
"description": "TypeScript server plugin.",
"properties": {
"name": {
"type": "string",
"description": "Name of the plugin as listed in the package.json."
}
}
}
}
}
}
}
}
@@ -172,10 +172,10 @@ export default class BufferSyncSupport {
}
public listen(): void {
workspace.onDidOpenTextDocument(this.onDidOpenTextDocument, this, this.disposables);
workspace.onDidOpenTextDocument(this.openTextDocument, this, this.disposables);
workspace.onDidCloseTextDocument(this.onDidCloseTextDocument, this, this.disposables);
workspace.onDidChangeTextDocument(this.onDidChangeTextDocument, this, this.disposables);
workspace.textDocuments.forEach(this.onDidOpenTextDocument, this);
workspace.textDocuments.forEach(this.openTextDocument, this);
}
public set validate(value: boolean) {
@@ -196,7 +196,7 @@ export default class BufferSyncSupport {
disposeAll(this.disposables);
}
private onDidOpenTextDocument(document: TextDocument): void {
public openTextDocument(document: TextDocument): void {
if (!this.modeIds.has(document.languageId)) {
return;
}
@@ -216,20 +216,23 @@ export default class BufferSyncSupport {
this.requestDiagnostic(resource);
}
private onDidCloseTextDocument(document: TextDocument): void {
const resource = document.uri;
public closeResource(resource: Uri): void {
const syncedBuffer = this.syncedBuffers.get(resource);
if (!syncedBuffer) {
return;
}
this.diagnostics.delete(resource);
this.syncedBuffers.delete(resource);
syncedBuffer.close();
if (!fs.existsSync(resource.fsPath)) {
this.diagnostics.delete(resource);
this.requestAllDiagnostics();
}
}
private onDidCloseTextDocument(document: TextDocument): void {
this.closeResource(document.uri);
}
private onDidChangeTextDocument(e: TextDocumentChangeEvent): void {
const syncedBuffer = this.syncedBuffers.get(e.document.uri);
if (syncedBuffer) {
@@ -253,6 +256,24 @@ export default class BufferSyncSupport {
}, 200);
}
public getErr(resources: Uri[]): any {
const handledResources = resources.filter(resource => this.handles(resource));
if (!handledResources.length) {
return;
}
for (const resource of handledResources) {
const file = this.client.normalizePath(resource);
if (file) {
this.pendingDiagnostics.set(file, Date.now());
}
}
this.diagnosticDelayer.trigger(() => {
this.sendPendingDiagnostics();
}, 200);
}
public requestDiagnostic(resource: Uri): void {
if (!this._validate) {
return;

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