From 507bae90b7bf07a25259364710c597620f03fb0e Mon Sep 17 00:00:00 2001 From: Anthony Dresser Date: Mon, 26 Aug 2019 15:58:42 -0700 Subject: [PATCH] Merge from vscode 91e99652cd5fcfc072387c64e151b435e39e8dcf (#6962) --- .vscode/cglicenses.schema.json | 70 +- build/azure-pipelines/exploration-build.yml | 17 +- cglicenses.json | 688 +----------------- .../src/features/preview.ts | 2 +- src/vs/base/browser/markdownRenderer.ts | 2 +- src/vs/base/browser/ui/dialog/dialog.ts | 7 - src/vs/base/browser/ui/grid/grid.ts | 111 +-- src/vs/base/browser/ui/grid/gridview.ts | 131 +++- .../browser/ui/octiconLabel/octiconLabel.ts | 4 +- .../ui/octiconLabel/octicons/octicons.css | 31 +- .../ui/octiconLabel/octicons/octicons.svg | 22 +- .../ui/octiconLabel/octicons/octicons.ttf | Bin 37504 -> 37484 bytes .../ui/octiconLabel/octicons/octicons2.css | 8 +- .../ui/octiconLabel/octicons/octicons2.ttf | Bin 35564 -> 35564 bytes src/vs/base/browser/ui/splitview/splitview.ts | 233 +++--- src/vs/base/common/filters.ts | 6 + src/vs/base/parts/ipc/common/ipc.net.ts | 8 +- src/vs/base/parts/request/browser/request.ts | 74 ++ src/vs/base/parts/request/common/request.ts | 30 + src/vs/base/test/common/filters.test.ts | 5 + src/vs/code/browser/workbench/workbench.html | 8 +- .../editor/browser/widget/diffEditorWidget.ts | 2 +- .../editor/browser/widget/inlineDiffMargin.ts | 103 ++- .../browser/widget/media/diffEditor.css | 13 + .../browser/widget/media/lightbulb-dark.svg | 3 + .../browser/widget/media/lightbulb-light.svg | 4 + .../common/config/commonEditorConfig.ts | 11 + src/vs/editor/common/config/editorOptions.ts | 23 +- .../editor/common/controller/cursorCommon.ts | 5 +- .../common/controller/cursorTypeOperations.ts | 34 +- .../common/controller/cursorWordOperations.ts | 32 +- .../common/modes/textToHtmlTokenizer.ts | 2 +- src/vs/editor/contrib/find/findWidget.css | 1 + src/vs/editor/contrib/find/findWidget.ts | 35 +- .../contrib/suggest/suggestController.ts | 51 +- src/vs/editor/contrib/suggest/suggestModel.ts | 5 +- .../test/wordOperations.test.ts | 40 +- .../contrib/wordOperations/wordOperations.ts | 91 +++ .../test/browser/controller/cursor.test.ts | 31 + .../common/modes/textToHtmlTokenizer.test.ts | 36 +- src/vs/monaco.d.ts | 11 + .../platform/dialogs/browser/dialogService.ts | 20 +- src/vs/platform/editor/common/editor.ts | 36 +- .../environment/common/environment.ts | 15 +- .../environment/node/environmentService.ts | 14 - .../common/extensionGalleryService.ts | 3 +- .../request/browser/requestService.ts | 73 +- src/vs/platform/request/common/request.ts | 26 +- src/vs/platform/request/common/requestIpc.ts | 3 +- .../request/electron-main/requestService.ts | 2 +- .../platform/request/node/requestService.ts | 3 +- .../api/browser/mainThreadWebview.ts | 3 +- src/vs/workbench/browser/layout.ts | 3 +- .../parts/editor/editor.contribution.ts | 2 +- .../workbench/browser/parts/editor/editor.ts | 1 + .../browser/parts/editor/editorActions.ts | 18 +- .../browser/parts/editor/editorControl.ts | 2 +- .../browser/parts/editor/editorGroupView.ts | 38 +- .../browser/parts/editor/editorPart.ts | 29 +- .../browser/parts/editor/textDiffEditor.ts | 7 + src/vs/workbench/browser/web.main.ts | 98 +-- .../browser/workbench.contribution.ts | 2 +- src/vs/workbench/common/editor.ts | 127 ++-- .../workbench/contrib/debug/browser/repl.ts | 2 +- .../browser/editors/fileEditorTracker.ts | 3 +- .../files/browser/editors/textFileEditor.ts | 8 + .../contrib/files/browser/explorerViewlet.ts | 10 +- .../contrib/files/browser/fileCommands.ts | 14 +- .../files/browser/views/explorerView.ts | 3 +- .../files/browser/views/openEditorsView.ts | 16 +- .../contrib/files/common/dirtyFilesTracker.ts | 5 +- .../preferences/browser/keybindingsEditor.ts | 22 +- .../quickopen/browser/gotoLineHandler.ts | 6 +- .../quickopen/browser/gotoSymbolHandler.ts | 10 +- .../contrib/search/browser/searchView.ts | 6 - .../contrib/tasks/common/jsonSchema_v2.ts | 2 +- .../terminal/browser/terminalConfigHelper.ts | 47 +- .../terminalConfigHelper.test.ts | 34 +- .../contrib/update/electron-browser/update.ts | 2 +- .../contrib/webview/browser/webviewElement.ts | 8 +- .../electron-browser/gettingStarted.ts | 4 +- .../configurationResolverService.test.ts | 9 +- .../dialogs/electron-browser/dialogService.ts | 8 +- .../services/editor/browser/editorService.ts | 138 ++-- .../editor/test/browser/editorService.test.ts | 2 +- .../environment/browser/environmentService.ts | 8 +- .../environment/common/environmentService.ts | 16 +- .../environment/node/environmentService.ts | 23 +- .../common/extensionHostProcessManager.ts | 4 +- .../common/remoteExtensionHostClient.ts | 4 +- .../electron-browser/extensionService.ts | 9 +- .../extensions/worker/extensionHostWorker.ts | 9 +- .../services/label/common/labelService.ts | 16 +- .../preferences/browser/preferencesService.ts | 2 +- .../common/keybindingsEditorModel.ts | 16 +- .../preferences/common/preferences.ts | 10 +- .../progress/browser/progressService.ts | 4 +- .../request/browser/requestService.ts | 2 +- .../services/search/node/searchService.ts | 5 +- .../textfile/common/textFileService.ts | 2 +- .../workbench/test/workbenchTestServices.ts | 4 + src/vs/workbench/workbench.web.api.ts | 6 + test/splitview/public/index.html | 272 +++++-- 103 files changed, 1743 insertions(+), 1543 deletions(-) create mode 100644 src/vs/base/parts/request/browser/request.ts create mode 100644 src/vs/base/parts/request/common/request.ts create mode 100644 src/vs/editor/browser/widget/media/lightbulb-dark.svg create mode 100644 src/vs/editor/browser/widget/media/lightbulb-light.svg diff --git a/.vscode/cglicenses.schema.json b/.vscode/cglicenses.schema.json index 238f4803f7..8c0ee74010 100644 --- a/.vscode/cglicenses.schema.json +++ b/.vscode/cglicenses.schema.json @@ -1,23 +1,61 @@ { "type": "array", "items": { - "type": "object", - "required": [ - "name", - "licenseDetail" - ], - "properties": { - "name": { - "type": "string", - "description": "The name of the dependency" + "oneOf": [ + { + "type": "object", + "required": [ + "name", + "prependLicenseText" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the dependency" + }, + "fullLicenseText": { + "type": "array", + "description": "The complete license text of the dependency", + "items": { + "type": "string" + } + }, + "prependLicenseText": { + "type": "array", + "description": "A piece of text to prepend to the auto-detected license text of the dependency", + "items": { + "type": "string" + } + } + } }, - "licenseDetail": { - "type": "array", - "description": "The complete license text of the dependency", - "items": { - "type": "string" + { + "type": "object", + "required": [ + "name", + "fullLicenseText" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the dependency" + }, + "fullLicenseText": { + "type": "array", + "description": "The complete license text of the dependency", + "items": { + "type": "string" + } + }, + "prependLicenseText": { + "type": "array", + "description": "A piece of text to prepend to the auto-detected license text of the dependency", + "items": { + "type": "string" + } + } } } - } + ] } -} \ No newline at end of file +} diff --git a/build/azure-pipelines/exploration-build.yml b/build/azure-pipelines/exploration-build.yml index 39a8f23b26..b1cce331c4 100644 --- a/build/azure-pipelines/exploration-build.yml +++ b/build/azure-pipelines/exploration-build.yml @@ -1,13 +1,6 @@ pool: vmImage: 'Ubuntu-16.04' -trigger: - branches: - include: ['master'] -pr: - branches: - include: ['master'] - steps: - task: NodeTool@0 inputs: @@ -38,3 +31,13 @@ steps: git push origin HEAD:electron-6.0.x displayName: Sync & Merge Exploration + +trigger: none +pr: none + +schedules: +- cron: "0 5 * * Mon-Fri" + displayName: Mon-Fri at 7:00 + branches: + include: + - master diff --git a/cglicenses.json b/cglicenses.json index b7f408109b..15b3036268 100644 --- a/cglicenses.json +++ b/cglicenses.json @@ -10,682 +10,32 @@ // Reason: The license at https://github.com/aadsm/jschardet/blob/master/LICENSE // does not include a clear Copyright statement and does not credit authors. "name": "jschardet", - "licenseDetail": [ + "prependLicenseText": [ "Chardet was originally ported from C++ by Mark Pilgrim. It is now maintained", " by Dan Blanchard and Ian Cordasco, and was formerly maintained by Erik Rose.", " JSChardet was ported from python to JavaScript by António Afonso ", " (https://github.com/aadsm/jschardet) and transformed into an npm package by ", - "Markus Ast (https://github.com/brainafk)", - "", - "GNU LESSER GENERAL PUBLIC LICENSE", - "\t\t Version 2.1, February 1999", - "", - " Copyright (C) 1991,", - "1999 Free Software Foundation, Inc.", - " 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA", - " Everyone is permitted to copy and distribute verbatim copies", - " of this license document, but changing it is not allowed.", - "", - "[This is the first released version of the Lesser GPL. It also counts", - " as the successor of the GNU Library Public License, version 2, hence", - " the version number 2.1.", - "]", - "", - "\t\t\t Preamble", - "", - " The licenses for most software are designed to take away your", - "freedom to share and change it. By contrast, the GNU General Public", - "Licenses are intended to guarantee your freedom to share and change", - "free software--to make sure the software is free for all its users.", - "", - " This license, the Lesser General Public License, applies to some", - "specially designated software packages--typically libraries--of the", - "Free Software Foundation and other authors who decide to use it. You", - "can use it too, but we suggest you first think carefully about whether", - "this license or the ordinary General Public License is the better", - "strategy to use in any particular case, based on the explanations below.", - "", - " When we speak of free software, we are referring to freedom of use,", - "not price. Our General Public Licenses are designed to make sure that", - "you have the freedom to distribute copies of free software (and charge", - "for this service if you wish); that you receive source code or can get", - "it if you want it; that you can change the software and use pieces of", - "it in new free programs; and that you are informed that you can do", - "these things.", - "", - " To protect your rights, we need to make restrictions that forbid", - "distributors to deny you these rights or to ask you to surrender these", - "rights. These restrictions translate to certain responsibilities for", - "you if you distribute copies of the library or if you modify it.", - "", - " For example, if you distribute copies of the library, whether gratis", - "or for a fee, you must give the recipients all the rights that we gave", - "you. You must make sure that they, too, receive or can get the source", - "code. If you link other code with the library, you must provide", - "complete object files to the recipients, so that they can relink them", - "with the library after making changes to the library and recompiling", - "it. And you must show them these terms so they know their rights.", - "", - " We protect your rights with a two-step method: (1) we copyright the", - "library, and (2) we offer you this license, which gives you legal", - "permission to copy, distribute and/or modify the library.", - "", - " To protect each distributor, we want to make it very clear that", - "there is no warranty for the free library. Also, if the library is", - "modified by someone else and passed on, the recipients should know", - "that what they have is not the original version, so that the original", - "author's reputation will not be affected by problems that might be", - "introduced by others.", - "", - " Finally, software patents pose a constant threat to the existence of", - "any free program. We wish to make sure that a company cannot", - "effectively restrict the users of a free program by obtaining a", - "restrictive license from a patent holder. Therefore, we insist that", - "any patent license obtained for a version of the library must be", - "consistent with the full freedom of use specified in this license.", - "", - " Most GNU software, including some libraries, is covered by the", - "ordinary GNU General Public License. This license, the GNU Lesser", - "General Public License, applies to certain designated libraries, and", - "is quite different from the ordinary General Public License. We use", - "this license for certain libraries in order to permit linking those", - "libraries into non-free programs.", - "", - " When a program is linked with a library, whether statically or using", - "a shared library, the combination of the two is legally speaking a", - "combined work, a derivative of the original library. The ordinary", - "General Public License therefore permits such linking only if the", - "entire combination fits its criteria of freedom. The Lesser General", - "Public License permits more lax criteria for linking other code with", - "the library.", - "", - " We call this license the \"Lesser\" General Public License because it", - "does Less to protect the user's freedom than the ordinary General", - "Public License. It also provides other free software developers Less", - "of an advantage over competing non-free programs. These disadvantages", - "are the reason we use the ordinary General Public License for many", - "libraries. However, the Lesser license provides advantages in certain", - "special circumstances.", - "", - " For example, on rare occasions, there may be a special need to", - "encourage the widest possible use of a certain library, so that it becomes", - "a de-facto standard. To achieve this, non-free programs must be", - "allowed to use the library. A more frequent case is that a free", - "library does the same job as widely used non-free libraries. In this", - "case, there is little to gain by limiting the free library to free", - "software only, so we use the Lesser General Public License.", - "", - " In other cases, permission to use a particular library in non-free", - "programs enables a greater number of people to use a large body of", - "free software. For example, permission to use the GNU C Library in", - "non-free programs enables many more people to use the whole GNU", - "operating system, as well as its variant, the GNU/Linux operating", - "system.", - "", - " Although the Lesser General Public License is Less protective of the", - "users' freedom, it does ensure that the user of a program that is", - "linked with the Library has the freedom and the wherewithal to run", - "that program using a modified version of the Library.", - "", - " The precise terms and conditions for copying, distribution and", - "modification follow. Pay close attention to the difference between a", - "\"work based on the library\" and a \"work that uses the library\". The", - "former contains code derived from the library, whereas the latter must", - "be combined with the library in order to run.", - "", - "\t\t GNU LESSER GENERAL PUBLIC LICENSE", - " TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION", - "", - " 0. This License Agreement applies to any software library or other", - "program which contains a notice placed by the copyright holder or", - "other authorized party saying it may be distributed under the terms of", - "this Lesser General Public License (also called \"this License\").", - "Each licensee is addressed as \"you\".", - "", - " A \"library\" means a collection of software functions and/or data", - "prepared so as to be conveniently linked with application programs", - "(which use some of those functions and data) to form executables.", - "", - " The \"Library\", below, refers to any such software library or work", - "which has been distributed under these terms. A \"work based on the", - "Library\" means either the Library or any derivative work under", - "copyright law: that is to say, a work containing the Library or a", - "portion of it, either verbatim or with modifications and/or translated", - "straightforwardly into another language. (Hereinafter, translation is", - "included without limitation in the term \"modification\".)", - "", - " \"Source code\" for a work means the preferred form of the work for", - "making modifications to it. For a library, complete source code means", - "all the source code for all modules it contains, plus any associated", - "interface definition files, plus the scripts used to control compilation", - "and installation of the library.", - "", - " Activities other than copying, distribution and modification are not", - "covered by this License; they are outside its scope. The act of", - "running a program using the Library is not restricted, and output from", - "such a program is covered only if its contents constitute a work based", - "on the Library (independent of the use of the Library in a tool for", - "writing it). Whether that is true depends on what the Library does", - "and what the program that uses the Library does.", - "", - " 1. You may copy and distribute verbatim copies of the Library's", - "complete source code as you receive it, in any medium, provided that", - "you conspicuously and appropriately publish on each copy an", - "appropriate copyright notice and disclaimer of warranty; keep intact", - "all the notices that refer to this License and to the absence of any", - "warranty; and distribute a copy of this License along with the", - "Library.", - "", - " You may charge a fee for the physical act of transferring a copy,", - "and you may at your option offer warranty protection in exchange for a", - "fee.", - "", - " 2. You may modify your copy or copies of the Library or any portion", - "of it, thus forming a work based on the Library, and copy and", - "distribute such modifications or work under the terms of Section 1", - "above, provided that you also meet all of these conditions:", - "", - " a) The modified work must itself be a software library.", - "", - " b) You must cause the files modified to carry prominent notices", - " stating that you changed the files and the date of any change.", - "", - " c) You must cause the whole of the work to be licensed at no", - " charge to all third parties under the terms of this License.", - "", - " d) If a facility in the modified Library refers to a function or a", - " table of data to be supplied by an application program that uses", - " the facility, other than as an argument passed when the facility", - " is invoked, then you must make a good faith effort to ensure that,", - " in the event an application does not supply such function or", - " table, the facility still operates, and performs whatever part of", - " its purpose remains meaningful.", - "", - " (For example, a function in a library to compute square roots has", - " a purpose that is entirely well-defined independent of the", - " application. Therefore, Subsection 2d requires that any", - " application-supplied function or table used by this function must", - " be optional: if the application does not supply it, the square", - " root function must still compute square roots.)", - "", - "These requirements apply to the modified work as a whole. If", - "identifiable sections of that work are not derived from the Library,", - "and can be reasonably considered independent and separate works in", - "themselves, then this License, and its terms, do not apply to those", - "sections when you distribute them as separate works. But when you", - "distribute the same sections as part of a whole which is a work based", - "on the Library, the distribution of the whole must be on the terms of", - "this License, whose permissions for other licensees extend to the", - "entire whole, and thus to each and every part regardless of who wrote", - "it.", - "", - "Thus, it is not the intent of this section to claim rights or contest", - "your rights to work written entirely by you; rather, the intent is to", - "exercise the right to control the distribution of derivative or", - "collective works based on the Library.", - "", - "In addition, mere aggregation of another work not based on the Library", - "with the Library (or with a work based on the Library) on a volume of", - "a storage or distribution medium does not bring the other work under", - "the scope of this License.", - "", - " 3. You may opt to apply the terms of the ordinary GNU General Public", - "License instead of this License to a given copy of the Library. To do", - "this, you must alter all the notices that refer to this License, so", - "that they refer to the ordinary GNU General Public License, version 2,", - "instead of to this License. (If a newer version than version 2 of the", - "ordinary GNU General Public License has appeared, then you can specify", - "that version instead if you wish.) Do not make any other change in", - "these notices.", - "", - " Once this change is made in a given copy, it is irreversible for", - "that copy, so the ordinary GNU General Public License applies to all", - "subsequent copies and derivative works made from that copy.", - "", - " This option is useful when you wish to copy part of the code of", - "the Library into a program that is not a library.", - "", - " 4. You may copy and distribute the Library (or a portion or", - "derivative of it, under Section 2) in object code or executable form", - "under the terms of Sections 1 and 2 above provided that you accompany", - "it with the complete corresponding machine-readable source code, which", - "must be distributed under the terms of Sections 1 and 2 above on a", - "medium customarily used for software interchange.", - "", - " If distribution of object code is made by offering access to copy", - "from a designated place, then offering equivalent access to copy the", - "source code from the same place satisfies the requirement to", - "distribute the source code, even though third parties are not", - "compelled to copy the source along with the object code.", - "", - " 5. A program that contains no derivative of any portion of the", - "Library, but is designed to work with the Library by being compiled or", - "linked with it, is called a \"work that uses the Library\". Such a", - "work, in isolation, is not a derivative work of the Library, and", - "therefore falls outside the scope of this License.", - "", - " However, linking a \"work that uses the Library\" with the Library", - "creates an executable that is a derivative of the Library (because it", - "contains portions of the Library), rather than a \"work that uses the", - "library\". The executable is therefore covered by this License.", - "Section 6 states terms for distribution of such executables.", - "", - " When a \"work that uses the Library\" uses material from a header file", - "that is part of the Library, the object code for the work may be a", - "derivative work of the Library even though the source code is not.", - "Whether this is true is especially significant if the work can be", - "linked without the Library, or if the work is itself a library. The", - "threshold for this to be true is not precisely defined by law.", - "", - " If such an object file uses only numerical parameters, data", - "structure layouts and accessors, and small macros and small inline", - "functions (ten lines or less in length), then the use of the object", - "file is unrestricted, regardless of whether it is legally a derivative", - "work. (Executables containing this object code plus portions of the", - "Library will still fall under Section 6.)", - "", - " Otherwise, if the work is a derivative of the Library, you may", - "distribute the object code for the work under the terms of Section 6.", - "Any executables containing that work also fall under Section 6,", - "whether or not they are linked directly with the Library itself.", - "", - " 6. As an exception to the Sections above, you may also combine or", - "link a \"work that uses the Library\" with the Library to produce a", - "work containing portions of the Library, and distribute that work", - "under terms of your choice, provided that the terms permit", - "modification of the work for the customer's own use and reverse", - "engineering for debugging such modifications.", - "", - " You must give prominent notice with each copy of the work that the", - "Library is used in it and that the Library and its use are covered by", - "this License. You must supply a copy of this License. If the work", - "during execution displays copyright notices, you must include the", - "copyright notice for the Library among them, as well as a reference", - "directing the user to the copy of this License. Also, you must do one", - "of these things:", - "", - " a) Accompany the work with the complete corresponding", - " machine-readable source code for the Library including whatever", - " changes were used in the work (which must be distributed under", - " Sections 1 and 2 above); and, if the work is an executable linked", - " with the Library, with the complete machine-readable \"work that", - " uses the Library\", as object code and/or source code, so that the", - " user can modify the Library and then relink to produce a modified", - " executable containing the modified Library. (It is understood", - " that the user who changes the contents of definitions files in the", - " Library will not necessarily be able to recompile the application", - " to use the modified definitions.)", - "", - " b) Use a suitable shared library mechanism for linking with the", - " Library. A suitable mechanism is one that (1) uses at run time a", - " copy of the library already present on the user's computer system,", - " rather than copying library functions into the executable, and (2)", - " will operate properly with a modified version of the library, if", - " the user installs one, as long as the modified version is", - " interface-compatible with the version that the work was made with.", - "", - " c) Accompany the work with a written offer, valid for at", - " least three years, to give the same user the materials", - " specified in Subsection 6a, above, for a charge no more", - " than the cost of performing this distribution.", - "", - " d) If distribution of the work is made by offering access to copy", - " from a designated place, offer equivalent access to copy the above", - " specified materials from the same place.", - "", - " e) Verify that the user has already received a copy of these", - " materials or that you have already sent this user a copy.", - "", - " For an executable, the required form of the \"work that uses the", - "Library\" must include any data and utility programs needed for", - "reproducing the executable from it. However, as a special exception,", - "the materials to be distributed need not include anything that is", - "normally distributed (in either source or binary form) with the major", - "components (compiler, kernel, and so on) of the operating system on", - "which the executable runs, unless that component itself accompanies", - "the executable.", - "", - " It may happen that this requirement contradicts the license", - "restrictions of other proprietary libraries that do not normally", - "accompany the operating system. Such a contradiction means you cannot", - "use both them and the Library together in an executable that you", - "distribute.", - "", - " 7. You may place library facilities that are a work based on the", - "Library side-by-side in a single library together with other library", - "facilities not covered by this License, and distribute such a combined", - "library, provided that the separate distribution of the work based on", - "the Library and of the other library facilities is otherwise", - "permitted, and provided that you do these two things:", - "", - " a) Accompany the combined library with a copy of the same work", - " based on the Library, uncombined with any other library", - " facilities. This must be distributed under the terms of the", - " Sections above.", - "", - " b) Give prominent notice with the combined library of the fact", - " that part of it is a work based on the Library, and explaining", - " where to find the accompanying uncombined form of the same work.", - "", - " 8. You may not copy, modify, sublicense, link with, or distribute", - "the Library except as expressly provided under this License. Any", - "attempt otherwise to copy, modify, sublicense, link with, or", - "distribute the Library is void, and will automatically terminate your", - "rights under this License. However, parties who have received copies,", - "or rights, from you under this License will not have their licenses", - "terminated so long as such parties remain in full compliance.", - "", - " 9. You are not required to accept this License, since you have not", - "signed it. However, nothing else grants you permission to modify or", - "distribute the Library or its derivative works. These actions are", - "prohibited by law if you do not accept this License. Therefore, by", - "modifying or distributing the Library (or any work based on the", - "Library), you indicate your acceptance of this License to do so, and", - "all its terms and conditions for copying, distributing or modifying", - "the Library or works based on it.", - "", - " 10. Each time you redistribute the Library (or any work based on the", - "Library), the recipient automatically receives a license from the", - "original licensor to copy, distribute, link with or modify the Library", - "subject to these terms and conditions. You may not impose any further", - "restrictions on the recipients' exercise of the rights granted herein.", - "You are not responsible for enforcing compliance by third parties with", - "this License.", - "", - " 11. If, as a consequence of a court judgment or allegation of patent", - "infringement or for any other reason (not limited to patent issues),", - "conditions are imposed on you (whether by court order, agreement or", - "otherwise) that contradict the conditions of this License, they do not", - "excuse you from the conditions of this License. If you cannot", - "distribute so as to satisfy simultaneously your obligations under this", - "License and any other pertinent obligations, then as a consequence you", - "may not distribute the Library at all. For example, if a patent", - "license would not permit royalty-free redistribution of the Library by", - "all those who receive copies directly or indirectly through you, then", - "the only way you could satisfy both it and this License would be to", - "refrain entirely from distribution of the Library.", - "", - "If any portion of this section is held invalid or unenforceable under any", - "particular circumstance, the balance of the section is intended to apply,", - "and the section as a whole is intended to apply in other circumstances.", - "", - "It is not the purpose of this section to induce you to infringe any", - "patents or other property right claims or to contest validity of any", - "such claims; this section has the sole purpose of protecting the", - "integrity of the free software distribution system which is", - "implemented by public license practices. Many people have made", - "generous contributions to the wide range of software distributed", - "through that system in reliance on consistent application of that", - "system; it is up to the author/donor to decide if he or she is willing", - "to distribute software through any other system and a licensee cannot", - "impose that choice.", - "", - "This section is intended to make thoroughly clear what is believed to", - "be a consequence of the rest of this License.", - "", - " 12. If the distribution and/or use of the Library is restricted in", - "certain countries either by patents or by copyrighted interfaces, the", - "original copyright holder who places the Library under this License may add", - "an explicit geographical distribution limitation excluding those countries,", - "so that distribution is permitted only in or among countries not thus", - "excluded. In such case, this License incorporates the limitation as if", - "written in the body of this License.", - "", - " 13. The Free Software Foundation may publish revised and/or new", - "versions of the Lesser General Public License from time to time.", - "Such new versions will be similar in spirit to the present version,", - "but may differ in detail to address new problems or concerns.", - "", - "Each version is given a distinguishing version number. If the Library", - "specifies a version number of this License which applies to it and", - "\"any later version\", you have the option of following the terms and", - "conditions either of that version or of any later version published by", - "the Free Software Foundation. If the Library does not specify a", - "license version number, you may choose any version ever published by", - "the Free Software Foundation.", - "", - " 14. If you wish to incorporate parts of the Library into other free", - "programs whose distribution conditions are incompatible with these,", - "write to the author to ask for permission. For software which is", - "copyrighted by the Free Software Foundation, write to the Free", - "Software Foundation; we sometimes make exceptions for this. Our", - "decision will be guided by the two goals of preserving the free status", - "of all derivatives of our free software and of promoting the sharing", - "and reuse of software generally.", - "", - "\t\t\t NO WARRANTY", - "", - " 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO", - "WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.", - "EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR", - "OTHER PARTIES PROVIDE THE LIBRARY \"AS IS\" WITHOUT WARRANTY OF ANY", - "KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE", - "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR", - "PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE", - "LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME", - "THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.", - "", - " 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN", - "WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY", - "AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU", - "FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR", - "CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE", - "LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING", - "RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A", - "FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF", - "SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH", - "DAMAGES.", - "", - "\t\t END OF TERMS AND CONDITIONS", - "", - " How to Apply These Terms to Your New Libraries", - "", - " If you develop a new library, and you want it to be of the greatest", - "possible use to the public, we recommend making it free software that", - "everyone can redistribute and change. You can do so by permitting", - "redistribution under these terms (or, alternatively, under the terms of the", - "ordinary General Public License).", - "", - " To apply these terms, attach the following notices to the library. It is", - "safest to attach them to the start of each source file to most effectively", - "convey the exclusion of warranty; and each file should have at least the", - "\"copyright\" line and a pointer to where the full notice is found.", - "", - " ", - " Copyright (C) ", - "", - " This library is free software; you can redistribute it and/or", - " modify it under the terms of the GNU Lesser General Public", - " License as published by the Free Software Foundation; either", - " version 2.1 of the License, or (at your option) any later version.", - "", - " This library is distributed in the hope that it will be useful,", - " but WITHOUT ANY WARRANTY; without even the implied warranty of", - " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU", - " Lesser General Public License for more details.", - "", - " You should have received a copy of the GNU Lesser General Public", - " License along with this library; if not, write to the Free Software", - " Foundation, Inc.,", - "51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA", - "", - "Also add information on how to contact you by electronic and paper mail.", - "", - "You should also get your employer (if you work as a programmer) or your", - "school, if any, to sign a \"copyright disclaimer\" for the library, if", - "necessary. Here is a sample; alter the names:", - "", - " Yoyodyne, Inc., hereby disclaims all copyright interest in the", - " library `Frob' (a library for tweaking knobs) written by James Random Hacker.", - "", - " ,", - "1 April 1990", - " Ty Coon, President of Vice", - "", - "That's all there is to it!" + "Markus Ast (https://github.com/brainafk)" ] }, { - // Added here because the module `parse5` has a dependency to it. - // The module `parse5` is shipped via the `extension-editing` built-in extension. - // The module `parse5` does not want to remove it https://github.com/inikulin/parse5/issues/225 - "name": "@types/node", - "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." - ] - }, - { - // We override the license that gets discovered at - // https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt - // because it does not contain a Copyright statement + // Reason: The license at https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt + // does not include a clear Copyright statement. "name": "typescript", - "licenseDetail": [ - "Copyright (c) Microsoft Corporation. All rights reserved.", - "", - "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" - ] - }, - { - // This module comes in from https://github.com/Microsoft/vscode-node-debug2/blob/master/package-lock.json - "name": "@types/source-map", - "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." + "prependLicenseText": [ + "Copyright (c) Microsoft Corporation. All rights reserved." ] }, { "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" + "prependLicenseText": [ + "Copyright (c) tunnel-agent authors" ] }, { - // Waiting for https://github.com/segmentio/noop-logger/issues/2 + // Reason: Waiting for https://github.com/segmentio/noop-logger/issues/2 "name": "noop-logger", - "licenseDetail": [ + "fullLicenseText": [ "This project is licensed under the MIT license.", "Copyrights are respective of each contributor listed at the beginning of each definition file.", "", @@ -697,8 +47,9 @@ ] }, { + // Reason: The npm module does not contain a repository field. "name": "xterm-addon-search", - "licenseDetail": [ + "fullLicenseText": [ "Copyright (c) 2017, The xterm.js authors (https://github.com/xtermjs/xterm.js)", "", "Permission is hereby granted, free of charge, to any person obtaining a copy", @@ -721,8 +72,9 @@ ] }, { + // Reason: The npm module does not contain a repository field. "name": "xterm-addon-web-links", - "licenseDetail": [ + "fullLicenseText": [ "Copyright (c) 2017, The xterm.js authors (https://github.com/xtermjs/xterm.js)", "", "Permission is hereby granted, free of charge, to any person obtaining a copy", @@ -745,8 +97,10 @@ ] }, { + // Reason: The license at https://git.coolaj86.com/coolaj86/atob.js/src/branch/master/LICENSE + // cannot be found by the OSS tool automatically. "name": "atob", - "licenseDetail": [ + "fullLicenseText": [ "The MIT License (MIT)", "", "Copyright (c) 2015 AJ ONeal", @@ -769,5 +123,13 @@ "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE", "SOFTWARE." ] + }, + { + // Reason: The license at https://github.com/microsoft/tslib/blob/master/LICENSE.txt + // does not include a clear Copyright statement. + "name": "tslib", + "prependLicenseText": [ + "Copyright (c) Microsoft Corporation. All rights reserved." + ] } ] diff --git a/extensions/markdown-language-features/src/features/preview.ts b/extensions/markdown-language-features/src/features/preview.ts index aa1f42d83c..d0c3ba3d61 100644 --- a/extensions/markdown-language-features/src/features/preview.ts +++ b/extensions/markdown-language-features/src/features/preview.ts @@ -271,7 +271,6 @@ export class MarkdownPreview extends Disposable { } public dispose() { - super.dispose(); if (this._disposed) { return; } @@ -282,6 +281,7 @@ export class MarkdownPreview extends Disposable { this._onDidChangeViewStateEmitter.dispose(); this.editor.dispose(); + super.dispose(); } public update(resource: vscode.Uri) { diff --git a/src/vs/base/browser/markdownRenderer.ts b/src/vs/base/browser/markdownRenderer.ts index 628440e6f9..73d71cd1aa 100644 --- a/src/vs/base/browser/markdownRenderer.ts +++ b/src/vs/base/browser/markdownRenderer.ts @@ -186,7 +186,7 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende renderer }; - const allowedSchemes = ['http', 'https', 'mailto']; + const allowedSchemes = ['http', 'https', 'mailto', 'data']; if (markdown.isTrusted) { allowedSchemes.push('command'); } diff --git a/src/vs/base/browser/ui/dialog/dialog.ts b/src/vs/base/browser/ui/dialog/dialog.ts index a367ebe6ff..27558b5b50 100644 --- a/src/vs/base/browser/ui/dialog/dialog.ts +++ b/src/vs/base/browser/ui/dialog/dialog.ts @@ -109,13 +109,6 @@ export class Dialog extends Disposable { return; } - if (this.modal) { - this._register(domEvent(this.modal, 'mousedown')(e => { - // Used to stop focusing of modal with mouse - EventHelper.stop(e, true); - })); - } - clearNode(this.buttonsContainer); let focusedButton = 0; diff --git a/src/vs/base/browser/ui/grid/grid.ts b/src/vs/base/browser/ui/grid/grid.ts index 26d7b77aa6..e80e8042bb 100644 --- a/src/vs/base/browser/ui/grid/grid.ts +++ b/src/vs/base/browser/ui/grid/grid.ts @@ -7,7 +7,7 @@ import 'vs/css!./gridview'; import { Orientation } from 'vs/base/browser/ui/sash/sash'; import { Disposable } from 'vs/base/common/lifecycle'; import { tail2 as tail, equals } from 'vs/base/common/arrays'; -import { orthogonal, IView as IGridViewView, GridView, Sizing as GridViewSizing, Box, IGridViewStyles, IViewSize, LayoutController, IGridViewOptions } from './gridview'; +import { orthogonal, IView as IGridViewView, GridView, Sizing as GridViewSizing, Box, IGridViewStyles, IViewSize, IGridViewOptions } from './gridview'; import { Event } from 'vs/base/common/event'; import { InvisibleSizing } from 'vs/base/browser/ui/splitview/splitview'; @@ -217,9 +217,17 @@ export class Grid extends Disposable { private didLayout = false; - constructor(view: T, options: IGridOptions = {}) { + constructor(gridview: GridView, options?: IGridOptions); + constructor(view: T, options?: IGridOptions); + constructor(view: T | GridView, options: IGridOptions = {}) { super(); - this.gridview = new GridView(options); + + if (view instanceof GridView) { + this.gridview = view; + this.gridview.getViewMap(this.views); + } else { + this.gridview = new GridView(options); + } this._register(this.gridview); this._register(this.gridview.onDidSashReset(this.onDidSashReset, this)); @@ -228,7 +236,9 @@ export class Grid extends Disposable { ? GridViewSizing.Invisible(options.firstViewVisibleCachedSize) : 0; - this._addView(view, size, [0]); + if (!(view instanceof GridView)) { + this._addView(view, size, [0]); + } } style(styles: IGridStyles): void { @@ -469,12 +479,6 @@ export interface IViewDeserializer { fromJSON(json: any): T; } -interface InitialLayoutContext { - width: number; - height: number; - root: GridBranchNode; -} - export interface ISerializedLeafNode { type: 'leaf'; data: any; @@ -567,31 +571,9 @@ export class SerializableGrid extends Grid { throw new Error('Invalid JSON: \'height\' property must be a number.'); } - const orientation = json.orientation; - const width = json.width; - const height = json.height; - const box: Box = { top: 0, left: 0, width, height }; + const gridview = GridView.deserialize(json, deserializer, options); + const result = new SerializableGrid(gridview, options); - const root = SerializableGrid.deserializeNode(json.root, orientation, box, deserializer) as GridBranchNode; - const firstLeaf = SerializableGrid.getFirstLeaf(root); - - if (!firstLeaf) { - throw new Error('Invalid serialized state, first leaf not found'); - } - - const layoutController = new LayoutController(false); - options = { ...options, layoutController }; - - if (typeof firstLeaf.cachedVisibleSize === 'number') { - options = { ...options, firstViewVisibleCachedSize: firstLeaf.cachedVisibleSize }; - } - - const result = new SerializableGrid(firstLeaf.view, options); - result.orientation = orientation; - result.restoreViews(firstLeaf.view, orientation, root); - result.initialLayoutContext = { width, height, root }; - - layoutController.isLayoutEnabled = true; return result; } @@ -599,7 +581,7 @@ export class SerializableGrid extends Grid { * Useful information in order to proportionally restore view sizes * upon the very first layout call. */ - private initialLayoutContext: InitialLayoutContext | undefined; + private initialLayoutContext: boolean = true; serialize(): ISerializedGrid { return { @@ -614,65 +596,8 @@ export class SerializableGrid extends Grid { super.layout(width, height); if (this.initialLayoutContext) { - const widthScale = width / this.initialLayoutContext.width; - const heightScale = height / this.initialLayoutContext.height; - - this.restoreViewsSize([], this.initialLayoutContext.root, this.orientation, widthScale, heightScale); - this.initialLayoutContext = undefined; - this.gridview.trySet2x2(); - } - } - - /** - * Recursively restores views which were just deserialized. - */ - private restoreViews(referenceView: T, orientation: Orientation, node: GridNode): void { - if (!isGridBranchNode(node)) { - return; - } - - const direction = orientation === Orientation.VERTICAL ? Direction.Down : Direction.Right; - const firstLeaves = node.children.map(c => SerializableGrid.getFirstLeaf(c)); - - for (let i = 1; i < firstLeaves.length; i++) { - const node = firstLeaves[i]; - const size: number | InvisibleSizing = typeof node.cachedVisibleSize === 'number' - ? GridViewSizing.Invisible(node.cachedVisibleSize) - : (orientation === Orientation.VERTICAL ? node.box.height : node.box.width); - this.addView(node.view, size, referenceView, direction); - referenceView = node.view; - } - - for (let i = 0; i < node.children.length; i++) { - this.restoreViews(firstLeaves[i].view, orthogonal(orientation), node.children[i]); - } - } - - /** - * Recursively restores view sizes. - * This should be called only after the very first layout call. - */ - private restoreViewsSize(location: number[], node: GridNode, orientation: Orientation, widthScale: number, heightScale: number): void { - if (!isGridBranchNode(node)) { - return; - } - - const scale = orientation === Orientation.VERTICAL ? heightScale : widthScale; - - for (let i = 0; i < node.children.length; i++) { - const child = node.children[i]; - const childLocation = [...location, i]; - - if (i < node.children.length - 1) { - const size = orientation === Orientation.VERTICAL - ? { height: Math.floor(child.box.height * scale) } - : { width: Math.floor(child.box.width * scale) }; - - this.gridview.resizeView(childLocation, size); - } - - this.restoreViewsSize(childLocation, child, orthogonal(orientation), widthScale, heightScale); + this.initialLayoutContext = false; } } } diff --git a/src/vs/base/browser/ui/grid/gridview.ts b/src/vs/base/browser/ui/grid/gridview.ts index bcdc9f3c53..d3784bed1e 100644 --- a/src/vs/base/browser/ui/grid/gridview.ts +++ b/src/vs/base/browser/ui/grid/gridview.ts @@ -34,6 +34,36 @@ export interface IView { setVisible?(visible: boolean): void; } +export interface ISerializableView extends IView { + toJSON(): object; +} + +export interface IViewDeserializer { + fromJSON(json: any): T; +} + +export interface ISerializedLeafNode { + type: 'leaf'; + data: any; + size: number; + visible?: boolean; +} + +export interface ISerializedBranchNode { + type: 'branch'; + data: ISerializedNode[]; + size: number; +} + +export type ISerializedNode = ISerializedLeafNode | ISerializedBranchNode; + +export interface ISerializedGridView { + root: ISerializedNode; + orientation: Orientation; + width: number; + height: number; +} + export function orthogonal(orientation: Orientation): Orientation { return orientation === Orientation.VERTICAL ? Orientation.HORIZONTAL : Orientation.VERTICAL; } @@ -179,18 +209,49 @@ class BranchNode implements ISplitView, IDisposable { styles: IGridViewStyles, readonly proportionalLayout: boolean, size: number = 0, - orthogonalSize: number = 0 + orthogonalSize: number = 0, + childDescriptors?: INodeDescriptor[] ) { this._styles = styles; this._size = size; this._orthogonalSize = orthogonalSize; this.element = $('.monaco-grid-branch-node'); - this.splitview = new SplitView(this.element, { orientation, styles, proportionalLayout }); - this.splitview.layout(size, orthogonalSize); + + if (!childDescriptors) { + // Normal behavior, we have no children yet, just set up the splitview + this.splitview = new SplitView(this.element, { orientation, styles, proportionalLayout }); + this.splitview.layout(size, orthogonalSize); + } else { + // Reconstruction behavior, we want to reconstruct a splitview + const descriptor = { + views: childDescriptors.map(childDescriptor => { + return { + view: childDescriptor.node, + size: childDescriptor.node.size, + visible: childDescriptor.node instanceof LeafNode && childDescriptor.visible !== undefined ? childDescriptor.visible : true + }; + }), + size: this.orthogonalSize + }; + + const options = { proportionalLayout, orientation, styles }; + + this.children = childDescriptors.map(c => c.node); + this.splitview = new SplitView(this.element, { ...options, descriptor }); + + this.children.forEach((node, index) => { + // Set up orthogonal sashes for children + node.orthogonalStartSash = this.splitview.sashes[index - 1]; + node.orthogonalEndSash = this.splitview.sashes[index]; + }); + } const onDidSashReset = Event.map(this.splitview.onDidSashReset, i => [i]); this.splitviewSashResetDisposable = onDidSashReset(this._onDidSashReset.fire, this._onDidSashReset); + + const onDidChildrenSashReset = Event.any(...this.children.map((c, i) => Event.map(c.onDidSashReset, location => [i, ...location]))); + this.childrenSashResetDisposable = onDidChildrenSashReset(this._onDidSashReset.fire, this._onDidSashReset); } style(styles: IGridViewStyles): void { @@ -226,7 +287,7 @@ class BranchNode implements ISplitView, IDisposable { } } - addChild(node: Node, size: number | Sizing, index: number): void { + addChild(node: Node, size: number | Sizing, index: number, skipLayout?: boolean): void { if (index < 0 || index > this.children.length) { throw new Error('Invalid index'); } @@ -484,9 +545,11 @@ class LeafNode implements ISplitView, IDisposable { readonly view: IView, readonly orientation: Orientation, readonly layoutController: ILayoutController, - orthogonalSize: number + orthogonalSize: number, + size: number = 0 ) { this._orthogonalSize = orthogonalSize; + this._size = size; this._onDidViewChange = Event.map(this.view.onDidChange, e => e && (this.orientation === Orientation.VERTICAL ? e.width : e.height)); this.onDidChange = Event.any(this._onDidViewChange, this._onDidSetLinkedNode.event, this._onDidLinkedWidthNodeChange.event, this._onDidLinkedHeightNodeChange.event); @@ -577,6 +640,11 @@ class LeafNode implements ISplitView, IDisposable { type Node = BranchNode | LeafNode; +export interface INodeDescriptor { + node: Node; + visible?: boolean; +} + function flipNode(node: T, size: number, orthogonalSize: number): T { if (node instanceof BranchNode) { const result = new BranchNode(orthogonal(node.orientation), node.layoutController, node.styles, node.proportionalLayout, size, orthogonalSize); @@ -680,6 +748,18 @@ export class GridView implements IDisposable { this.root = new BranchNode(Orientation.VERTICAL, this.layoutController, this.styles, this.proportionalLayout); } + getViewMap(map: Map, node?: Node): void { + if (!node) { + node = this.root; + } + + if (node instanceof BranchNode) { + node.children.forEach(child => this.getViewMap(map, child)); + } else { + map.set(node.view, node.element); + } + } + style(styles: IGridViewStyles): void { this.styles = styles; this.root.style(styles); @@ -953,6 +1033,47 @@ export class GridView implements IDisposable { return this._getViews(node, this.orientation, { top: 0, left: 0, width: this.width, height: this.height }); } + static deserialize(json: ISerializedGridView, deserializer: IViewDeserializer, options: IGridViewOptions = {}): GridView { + if (typeof json.orientation !== 'number') { + throw new Error('Invalid JSON: \'orientation\' property must be a number.'); + } else if (typeof json.width !== 'number') { + throw new Error('Invalid JSON: \'width\' property must be a number.'); + } else if (typeof json.height !== 'number') { + throw new Error('Invalid JSON: \'height\' property must be a number.'); + } + + const orientation = json.orientation; + const height = json.height; + + const result = new GridView(options); + result._deserialize(json.root as ISerializedBranchNode, orientation, deserializer, height); + + return result; + } + + private _deserialize(root: ISerializedBranchNode, orientation: Orientation, deserializer: IViewDeserializer, orthogonalSize: number): void { + this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize) as BranchNode; + } + + private _deserializeNode(node: ISerializedNode, orientation: Orientation, deserializer: IViewDeserializer, orthogonalSize: number): Node { + let result: Node; + if (node.type === 'branch') { + const serializedChildren = node.data as ISerializedNode[]; + const children = serializedChildren.map(serializedChild => { + return { + node: this._deserializeNode(serializedChild, orthogonal(orientation), deserializer, node.size), + visible: (serializedChild as { visible?: boolean }).visible + } as INodeDescriptor; + }); + + result = new BranchNode(orientation, this.layoutController, this.styles, this.proportionalLayout, node.size, orthogonalSize, children); + } else { + result = new LeafNode(deserializer.fromJSON(node.data), orientation, this.layoutController, orthogonalSize, node.size); + } + + return result; + } + private _getViews(node: Node, orientation: Orientation, box: Box, cachedVisibleSize?: number): GridNode { if (node instanceof LeafNode) { return { view: node.view, box, cachedVisibleSize }; diff --git a/src/vs/base/browser/ui/octiconLabel/octiconLabel.ts b/src/vs/base/browser/ui/octiconLabel/octiconLabel.ts index 0332245db3..f43ac7bd68 100644 --- a/src/vs/base/browser/ui/octiconLabel/octiconLabel.ts +++ b/src/vs/base/browser/ui/octiconLabel/octiconLabel.ts @@ -4,6 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import 'vs/css!./octicons/octicons'; +import 'vs/css!./octicons/octicons2'; +import 'vs/css!./octicons/octicons-main'; import 'vs/css!./octicons/octicons-animations'; import { escape } from 'vs/base/common/strings'; @@ -30,4 +32,4 @@ export class OcticonLabel { set title(title: string) { this._container.title = title; } -} \ No newline at end of file +} diff --git a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.css b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.css index d9cc1b7a4f..381ae0fd1c 100644 --- a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.css +++ b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.css @@ -1,7 +1,7 @@ @font-face { font-family: "octicons"; - src: url("./octicons.ttf?1b0f2a9535896866c74dd24eedeb4374") format("truetype"), -url("./octicons.svg?1b0f2a9535896866c74dd24eedeb4374#octicons") format("svg"); + src: url("./octicons.ttf?759e9adce5213a11e27cd79af7448e2e") format("truetype"), +url("./octicons.svg?759e9adce5213a11e27cd79af7448e2e#octicons") format("svg"); } .octicon, .mega-octicon { @@ -169,7 +169,7 @@ url("./octicons.svg?1b0f2a9535896866c74dd24eedeb4374#octicons") format("svg"); .octicon-person-outline:before { content: "\f018" } .octicon-pin:before { content: "\f041" } .octicon-plug:before { content: "\f0d4" } -.octicon-plus-small:before { content: "\f28a" } +.octicon-plus-small:before { content: "\f05d" } .octicon-plus:before { content: "\f05d" } .octicon-primitive-dot:before { content: "\f052" } .octicon-primitive-square:before { content: "\f053" } @@ -233,16 +233,19 @@ url("./octicons.svg?1b0f2a9535896866c74dd24eedeb4374#octicons") format("svg"); .octicon-watch:before { content: "\f0e0" } .octicon-x:before { content: "\f081" } .octicon-zap:before { content: "\26a1" } +.octicon-error:before { content: "\26b1" } +.octicon-eye-closed:before { content: "\26b0" } +.octicon-fold-down:before { content: "\26a4" } +.octicon-fold-up:before { content: "\26a5" } +.octicon-github-action:before { content: "\26a6" } +.octicon-info-outline:before { content: "\26a7" } +.octicon-play:before { content: "\26a8" } +.octicon-remote:before { content: "\26a9" } +.octicon-request-changes:before { content: "\26aa" } +.octicon-smiley-outline:before { content: "\f27d" } +.octicon-warning:before { content: "\f02d" } +.octicon-controls:before { content: "\26ad" } +.octicon-event:before { content: "\26ae" } +.octicon-record-keys:before { content: "\26af" } .octicon-archive:before { content: "\f101" } .octicon-arrow-both:before { content: "\f102" } -.octicon-error:before { content: "\f103" } -.octicon-eye-closed:before { content: "\f104" } -.octicon-fold-down:before { content: "\f105" } -.octicon-fold-up:before { content: "\f106" } -.octicon-github-action:before { content: "\f107" } -.octicon-info-outline:before { content: "\f108" } -.octicon-play:before { content: "\f109" } -.octicon-remote:before { content: "\f10a" } -.octicon-request-changes:before { content: "\f10b" } -.octicon-smiley-outline:before { content: "\f10c" } -.octicon-warning:before { content: "\f10d" } diff --git a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.svg b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.svg index 3f4ab4f180..8eca48d0e1 100644 --- a/src/vs/base/browser/ui/octiconLabel/octicons/octicons.svg +++ b/src/vs/base/browser/ui/octiconLabel/octicons/octicons.svg @@ -167,10 +167,10 @@ unicode="" horiz-adv-x="750" d=" M687.5 507.5H62.5C28.125 507.5 0 479.375 0 445V195C0 160.625 28.125 132.5 62.5 132.5H687.5C721.875 132.5 750 160.625 750 195V445C750 479.375 721.875 507.5 687.5 507.5zM250 257.5H125V382.5H250V257.5zM437.5 257.5H312.5V382.5H437.5V257.5zM625 257.5H500V382.5H625V257.5z" /> n~o2kVW6)(%7tOSnkw@JnJbWjHKW)AHwFQrJP6Ne(W? z{JZ$`yEsU0?rzFK+JREEklQ@lo9El7=k0xap6|Ceno`~ml}(pp@Svj_Fg*h$MU%n# ziE!Un0H_E8;jgK{*mzCJn;zHQiuN8~uhaa1VhhcLXJ6{?T7lSH{Mu!|x({VXOFO?& ztiFQlG4}BD-whLesLf7L?m~4y&7YdM7qP1oCgqnOeDJ^wy9kIgaha$!_iIXKEfdRZ zWU~O@?u(1Wg86(2JndsmBZOJ3vbM2#%S$@>XoUO}p$O;Daf?Mn(TyH>F@zOt@cuTmVuGFG##TW)sm(|lX-gwnpLrrz zHwl~7y(A7fD#ODNDG9HEIFj%}h+_$_hB%S13B;*{?I6x1Yz%QB;Rq0y5)Ok;w#mV< W@X24x7{k^vOTwd7QqmaEoXdX*V{bD6 delta 493 zcmXw#J4nJ&6vn^v|NF>H%nB)!k_s_7wq=uj$&I)-gN_q$H}bEnKygpr>wo7FspCi zdb0mK|F0PxeW)#NP~kvzK`riDc`apEH*`vlFD5VmJsj?^JDqar$E+4@Upv$i`8>d9 zXQ>VSb&&Yg1ST)Ls-P;eQ#H%Ma#9_+$Xir9N%^RY)kl6B zrcnyf3azkz0Jm60Jac8}rpbhEFo3WWp--VxW-KHF-j!f1R zGj0kMC;%Rb&`G!ngkHk!APf?23}KY81w@I2%^*w?wuRvN6yN|5W(h}uD3fp~2uqP# Ta6V{j5>5(jUBa3DHt*IS#iVi& diff --git a/src/vs/base/browser/ui/octiconLabel/octicons/octicons2.css b/src/vs/base/browser/ui/octiconLabel/octicons/octicons2.css index 2e45f18052..aa31d3d92b 100644 --- a/src/vs/base/browser/ui/octiconLabel/octicons/octicons2.css +++ b/src/vs/base/browser/ui/octiconLabel/octicons/octicons2.css @@ -1,7 +1,7 @@ @font-face { font-family: "octicons2"; - src: url("./octicons2.ttf?dee9935d8deb764a470d194d9f0d07f7") format("truetype"), -url("./octicons2.svg?dee9935d8deb764a470d194d9f0d07f7#octicons2") format("svg"); + src: url("./octicons2.ttf?e9cbaa049a291f47ea2a38815e18222e") format("truetype"), +url("./octicons2.svg?e9cbaa049a291f47ea2a38815e18222e#octicons2") format("svg"); } .octicon, .mega-octicon { @@ -157,7 +157,7 @@ url("./octicons2.svg?dee9935d8deb764a470d194d9f0d07f7#octicons2") format("svg"); .octicon-note:before { content: "\f289" } .octicon-octoface:before { content: "\f008" } .octicon-organization:before { content: "\f037" } -.octicon-organization-filled:before { content: "\26a2" } +.octicon-organization-filled:before { content: "\f037" } .octicon-organization-outline:before { content: "\f037" } .octicon-package:before { content: "\f0c4" } .octicon-paintcan:before { content: "\f0d1" } @@ -165,7 +165,7 @@ url("./octicons2.svg?dee9935d8deb764a470d194d9f0d07f7#octicons2") format("svg"); .octicon-person-add:before { content: "\f018" } .octicon-person-follow:before { content: "\f018" } .octicon-person:before { content: "\f018" } -.octicon-person-filled:before { content: "\26a3" } +.octicon-person-filled:before { content: "\f018" } .octicon-person-outline:before { content: "\f018" } .octicon-pin:before { content: "\f041" } .octicon-plug:before { content: "\f0d4" } diff --git a/src/vs/base/browser/ui/octiconLabel/octicons/octicons2.ttf b/src/vs/base/browser/ui/octiconLabel/octicons/octicons2.ttf index daa9a772ad2ea0963483e58ae0f3d30c2d558cc9..2f462482ad5b0dae13f8b7f2f281cfedd699d10d 100644 GIT binary patch delta 48 xcmaDemFdk?rU`+}QqOHBhD?<%_^>jb-{va=H}eYyAh_9i@g0ob%)7t+p|q-{va=H}eYyAh=oYk^`eRvoOBs1OT$M5Xk@l diff --git a/src/vs/base/browser/ui/splitview/splitview.ts b/src/vs/base/browser/ui/splitview/splitview.ts index 769b2a7101..8f74bc3637 100644 --- a/src/vs/base/browser/ui/splitview/splitview.ts +++ b/src/vs/base/browser/ui/splitview/splitview.ts @@ -29,7 +29,8 @@ export interface ISplitViewOptions { readonly orthogonalStartSash?: Sash; readonly orthogonalEndSash?: Sash; readonly inverseAltBehavior?: boolean; - readonly proportionalLayout?: boolean; // default true + readonly proportionalLayout?: boolean; // default true, + readonly descriptor?: ISplitViewDescriptor; } /** @@ -197,6 +198,15 @@ export namespace Sizing { export function Invisible(cachedVisibleSize: number): InvisibleSizing { return { type: 'invisible', cachedVisibleSize }; } } +export interface ISplitViewDescriptor { + size: number; + views: { + visible?: boolean; + size: number; + view: IView; + }[]; +} + export class SplitView extends Disposable { readonly orientation: Orientation; @@ -272,6 +282,21 @@ export class SplitView extends Disposable { this.viewContainer = dom.append(this.el, dom.$('.split-view-container')); this.style(options.styles || defaultStyles); + + // We have an existing set of view, add them now + if (options.descriptor) { + this.size = options.descriptor.size; + options.descriptor.views.forEach((viewDescriptor, index) => { + const sizing = types.isUndefined(viewDescriptor.visible) || viewDescriptor.visible ? viewDescriptor.size : { type: 'invisible', cachedVisibleSize: viewDescriptor.size } as InvisibleSizing; + + const view = viewDescriptor.view; + this.doAddView(view, sizing, index, true); + }); + + // Initialize content size and proportions for first layout + this.contentSize = this.viewItems.reduce((r, i) => r + i.size, 0); + this.saveProportions(); + } } style(styles: ISplitViewStyles): void { @@ -285,102 +310,7 @@ export class SplitView extends Disposable { } addView(view: IView, size: number | Sizing, index = this.viewItems.length): void { - if (this.state !== State.Idle) { - throw new Error('Cant modify splitview'); - } - - this.state = State.Busy; - - // Add view - const container = dom.$('.split-view-view'); - - if (index === this.viewItems.length) { - this.viewContainer.appendChild(container); - } else { - this.viewContainer.insertBefore(container, this.viewContainer.children.item(index)); - } - - const onChangeDisposable = view.onDidChange(size => this.onViewChange(item, size)); - const containerDisposable = toDisposable(() => this.viewContainer.removeChild(container)); - const disposable = combinedDisposable(onChangeDisposable, containerDisposable); - - let viewSize: ViewItemSize; - - if (typeof size === 'number') { - viewSize = size; - } else if (size.type === 'split') { - viewSize = this.getViewSize(size.index) / 2; - } else if (size.type === 'invisible') { - viewSize = { cachedVisibleSize: size.cachedVisibleSize }; - } else { - viewSize = view.minimumSize; - } - - const item = this.orientation === Orientation.VERTICAL - ? new VerticalViewItem(container, view, viewSize, disposable) - : new HorizontalViewItem(container, view, viewSize, disposable); - - this.viewItems.splice(index, 0, item); - - // Add sash - if (this.viewItems.length > 1) { - const orientation = this.orientation === Orientation.VERTICAL ? Orientation.HORIZONTAL : Orientation.VERTICAL; - const layoutProvider = this.orientation === Orientation.VERTICAL ? { getHorizontalSashTop: (sash: Sash) => this.getSashPosition(sash) } : { getVerticalSashLeft: (sash: Sash) => this.getSashPosition(sash) }; - const sash = new Sash(this.sashContainer, layoutProvider, { - orientation, - orthogonalStartSash: this.orthogonalStartSash, - orthogonalEndSash: this.orthogonalEndSash - }); - - const sashEventMapper = this.orientation === Orientation.VERTICAL - ? (e: IBaseSashEvent) => ({ sash, start: e.startY, current: e.currentY, alt: e.altKey }) - : (e: IBaseSashEvent) => ({ sash, start: e.startX, current: e.currentX, alt: e.altKey }); - - const onStart = Event.map(sash.onDidStart, sashEventMapper); - const onStartDisposable = onStart(this.onSashStart, this); - const onChange = Event.map(sash.onDidChange, sashEventMapper); - const onChangeDisposable = onChange(this.onSashChange, this); - const onEnd = Event.map(sash.onDidEnd, () => firstIndex(this.sashItems, item => item.sash === sash)); - const onEndDisposable = onEnd(this.onSashEnd, this); - - const onDidResetDisposable = sash.onDidReset(() => { - const index = firstIndex(this.sashItems, item => item.sash === sash); - const upIndexes = range(index, -1); - const downIndexes = range(index + 1, this.viewItems.length); - const snapBeforeIndex = this.findFirstSnapIndex(upIndexes); - const snapAfterIndex = this.findFirstSnapIndex(downIndexes); - - if (typeof snapBeforeIndex === 'number' && !this.viewItems[snapBeforeIndex].visible) { - return; - } - - if (typeof snapAfterIndex === 'number' && !this.viewItems[snapAfterIndex].visible) { - return; - } - - this._onDidSashReset.fire(index); - }); - - const disposable = combinedDisposable(onStartDisposable, onChangeDisposable, onEndDisposable, onDidResetDisposable, sash); - const sashItem: ISashItem = { sash, disposable }; - - this.sashItems.splice(index - 1, 0, sashItem); - } - - container.appendChild(view.element); - - let highPriorityIndexes: number[] | undefined; - - if (typeof size !== 'number' && size.type === 'split') { - highPriorityIndexes = [size.index]; - } - - this.relayout([index], highPriorityIndexes); - this.state = State.Idle; - - if (typeof size !== 'number' && size.type === 'distribute') { - this.distributeViewSizes(); - } + this.doAddView(view, size, index, false); } removeView(index: number, sizing?: Sizing): IView { @@ -689,6 +619,108 @@ export class SplitView extends Disposable { return this.viewItems[index].size; } + private doAddView(view: IView, size: number | Sizing, index = this.viewItems.length, skipLayout?: boolean): void { + if (this.state !== State.Idle) { + throw new Error('Cant modify splitview'); + } + + this.state = State.Busy; + + // Add view + const container = dom.$('.split-view-view'); + + if (index === this.viewItems.length) { + this.viewContainer.appendChild(container); + } else { + this.viewContainer.insertBefore(container, this.viewContainer.children.item(index)); + } + + const onChangeDisposable = view.onDidChange(size => this.onViewChange(item, size)); + const containerDisposable = toDisposable(() => this.viewContainer.removeChild(container)); + const disposable = combinedDisposable(onChangeDisposable, containerDisposable); + + let viewSize: ViewItemSize; + + if (typeof size === 'number') { + viewSize = size; + } else if (size.type === 'split') { + viewSize = this.getViewSize(size.index) / 2; + } else if (size.type === 'invisible') { + viewSize = { cachedVisibleSize: size.cachedVisibleSize }; + } else { + viewSize = view.minimumSize; + } + + const item = this.orientation === Orientation.VERTICAL + ? new VerticalViewItem(container, view, viewSize, disposable) + : new HorizontalViewItem(container, view, viewSize, disposable); + + this.viewItems.splice(index, 0, item); + + // Add sash + if (this.viewItems.length > 1) { + const orientation = this.orientation === Orientation.VERTICAL ? Orientation.HORIZONTAL : Orientation.VERTICAL; + const layoutProvider = this.orientation === Orientation.VERTICAL ? { getHorizontalSashTop: (sash: Sash) => this.getSashPosition(sash) } : { getVerticalSashLeft: (sash: Sash) => this.getSashPosition(sash) }; + const sash = new Sash(this.sashContainer, layoutProvider, { + orientation, + orthogonalStartSash: this.orthogonalStartSash, + orthogonalEndSash: this.orthogonalEndSash + }); + + const sashEventMapper = this.orientation === Orientation.VERTICAL + ? (e: IBaseSashEvent) => ({ sash, start: e.startY, current: e.currentY, alt: e.altKey }) + : (e: IBaseSashEvent) => ({ sash, start: e.startX, current: e.currentX, alt: e.altKey }); + + const onStart = Event.map(sash.onDidStart, sashEventMapper); + const onStartDisposable = onStart(this.onSashStart, this); + const onChange = Event.map(sash.onDidChange, sashEventMapper); + const onChangeDisposable = onChange(this.onSashChange, this); + const onEnd = Event.map(sash.onDidEnd, () => firstIndex(this.sashItems, item => item.sash === sash)); + const onEndDisposable = onEnd(this.onSashEnd, this); + + const onDidResetDisposable = sash.onDidReset(() => { + const index = firstIndex(this.sashItems, item => item.sash === sash); + const upIndexes = range(index, -1); + const downIndexes = range(index + 1, this.viewItems.length); + const snapBeforeIndex = this.findFirstSnapIndex(upIndexes); + const snapAfterIndex = this.findFirstSnapIndex(downIndexes); + + if (typeof snapBeforeIndex === 'number' && !this.viewItems[snapBeforeIndex].visible) { + return; + } + + if (typeof snapAfterIndex === 'number' && !this.viewItems[snapAfterIndex].visible) { + return; + } + + this._onDidSashReset.fire(index); + }); + + const disposable = combinedDisposable(onStartDisposable, onChangeDisposable, onEndDisposable, onDidResetDisposable, sash); + const sashItem: ISashItem = { sash, disposable }; + + this.sashItems.splice(index - 1, 0, sashItem); + } + + container.appendChild(view.element); + + let highPriorityIndexes: number[] | undefined; + + if (typeof size !== 'number' && size.type === 'split') { + highPriorityIndexes = [size.index]; + } + + if (!skipLayout) { + this.relayout([index], highPriorityIndexes); + } + + this.state = State.Idle; + + if (!skipLayout && typeof size !== 'number' && size.type === 'distribute') { + this.distributeViewSizes(); + } + } + private relayout(lowPriorityIndexes?: number[], highPriorityIndexes?: number[]): void { const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0); @@ -850,9 +882,12 @@ export class SplitView extends Disposable { const snapBeforeIndex = this.findFirstSnapIndex(upIndexes); const snapAfterIndex = this.findFirstSnapIndex(downIndexes); - if (typeof snapBeforeIndex === 'number' && !this.viewItems[snapBeforeIndex].visible) { + const snappedBefore = typeof snapBeforeIndex === 'number' && !this.viewItems[snapBeforeIndex].visible; + const snappedAfter = typeof snapAfterIndex === 'number' && !this.viewItems[snapAfterIndex].visible; + + if (snappedBefore && collapsesUp[index]) { sash.state = SashState.Minimum; - } else if (typeof snapAfterIndex === 'number' && !this.viewItems[snapAfterIndex].visible) { + } else if (snappedAfter && collapsesDown[index]) { sash.state = SashState.Maximum; } else { sash.state = SashState.Disabled; diff --git a/src/vs/base/common/filters.ts b/src/vs/base/common/filters.ts index 0159591a39..d49c7f589b 100644 --- a/src/vs/base/common/filters.ts +++ b/src/vs/base/common/filters.ts @@ -532,6 +532,12 @@ export interface FuzzyScorer { export function fuzzyScore(pattern: string, patternLow: string, patternPos: number, word: string, wordLow: string, wordPos: number, firstMatchCanBeWeak: boolean): FuzzyScore | undefined { + if (patternPos > 0) { + pattern = pattern.substr(patternPos); + patternLow = patternLow.substr(patternPos); + patternPos = 0; + } + const patternLen = pattern.length > _maxLen ? _maxLen : pattern.length; const wordLen = word.length > _maxLen ? _maxLen : word.length; diff --git a/src/vs/base/parts/ipc/common/ipc.net.ts b/src/vs/base/parts/ipc/common/ipc.net.ts index b26a5dded3..4b0be27f6d 100644 --- a/src/vs/base/parts/ipc/common/ipc.net.ts +++ b/src/vs/base/parts/ipc/common/ipc.net.ts @@ -420,7 +420,7 @@ export class BufferedEmitter { // it is important to deliver these messages after this call, but before // other messages have a chance to be received (to guarantee in order delivery) // that's why we're using here nextTick and not other types of timeouts - process.nextTick(() => this._deliverMessages); + process.nextTick(() => this._deliverMessages()); }, onLastListenerRemove: () => { this._hasListeners = false; @@ -443,7 +443,11 @@ export class BufferedEmitter { public fire(event: T): void { if (this._hasListeners) { - this._emitter.fire(event); + if (this._bufferedMessages.length > 0) { + this._bufferedMessages.push(event); + } else { + this._emitter.fire(event); + } } else { this._bufferedMessages.push(event); } diff --git a/src/vs/base/parts/request/browser/request.ts b/src/vs/base/parts/request/browser/request.ts new file mode 100644 index 0000000000..3d686024f2 --- /dev/null +++ b/src/vs/base/parts/request/browser/request.ts @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { CancellationToken } from 'vs/base/common/cancellation'; +import { canceled } from 'vs/base/common/errors'; +import { assign } from 'vs/base/common/objects'; +import { VSBuffer, bufferToStream } from 'vs/base/common/buffer'; +import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request'; + +export function request(options: IRequestOptions, token: CancellationToken): Promise { + if (options.proxyAuthorization) { + options.headers = assign(options.headers || {}, { 'Proxy-Authorization': options.proxyAuthorization }); + } + + const xhr = new XMLHttpRequest(); + return new Promise((resolve, reject) => { + + xhr.open(options.type || 'GET', options.url || '', true, options.user, options.password); + setRequestHeaders(xhr, options); + + xhr.responseType = 'arraybuffer'; + xhr.onerror = e => reject(new Error(xhr.statusText && ('XHR failed: ' + xhr.statusText))); + xhr.onload = (e) => { + resolve({ + res: { + statusCode: xhr.status, + headers: getResponseHeaders(xhr) + }, + stream: bufferToStream(VSBuffer.wrap(new Uint8Array(xhr.response))) + }); + }; + xhr.ontimeout = e => reject(new Error(`XHR timeout: ${options.timeout}ms`)); + + if (options.timeout) { + xhr.timeout = options.timeout; + } + + xhr.send(options.data); + + // cancel + token.onCancellationRequested(() => { + xhr.abort(); + reject(canceled()); + }); + }); +} + +function setRequestHeaders(xhr: XMLHttpRequest, options: IRequestOptions): void { + if (options.headers) { + outer: for (let k in options.headers) { + switch (k) { + case 'User-Agent': + case 'Accept-Encoding': + case 'Content-Length': + // unsafe headers + continue outer; + } + xhr.setRequestHeader(k, options.headers[k]); + } + } +} + +function getResponseHeaders(xhr: XMLHttpRequest): { [name: string]: string } { + const headers: { [name: string]: string } = Object.create(null); + for (const line of xhr.getAllResponseHeaders().split(/\r\n|\n|\r/g)) { + if (line) { + const idx = line.indexOf(':'); + headers[line.substr(0, idx).trim().toLowerCase()] = line.substr(idx + 1).trim(); + } + } + return headers; +} diff --git a/src/vs/base/parts/request/common/request.ts b/src/vs/base/parts/request/common/request.ts new file mode 100644 index 0000000000..cedc62ee04 --- /dev/null +++ b/src/vs/base/parts/request/common/request.ts @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { VSBufferReadableStream } from 'vs/base/common/buffer'; + +export interface IHeaders { + [header: string]: string; +} + +export interface IRequestOptions { + type?: string; + url?: string; + user?: string; + password?: string; + headers?: IHeaders; + timeout?: number; + data?: string; + followRedirects?: number; + proxyAuthorization?: string; +} + +export interface IRequestContext { + res: { + headers: IHeaders; + statusCode?: number; + }; + stream: VSBufferReadableStream; +} diff --git a/src/vs/base/test/common/filters.test.ts b/src/vs/base/test/common/filters.test.ts index ebb8bf854b..d149f09865 100644 --- a/src/vs/base/test/common/filters.test.ts +++ b/src/vs/base/test/common/filters.test.ts @@ -389,6 +389,11 @@ suite('Filters', () => { assertMatches('g', 'zzGroup', 'zz^Group', fuzzyScore); }); + test('patternPos isn\'t working correctly #79815', function () { + assertMatches(':p'.substr(1), 'prop', '^prop', fuzzyScore, { patternPos: 0 }); + assertMatches(':p', 'prop', '^prop', fuzzyScore, { patternPos: 1 }); + }); + function assertTopScore(filter: typeof fuzzyScore, pattern: string, expected: number, ...words: string[]) { let topScore = -(100 * 10); let topIdx = 0; diff --git a/src/vs/code/browser/workbench/workbench.html b/src/vs/code/browser/workbench/workbench.html index 9c7defe5af..44f67f0a0b 100644 --- a/src/vs/code/browser/workbench/workbench.html +++ b/src/vs/code/browser/workbench/workbench.html @@ -10,18 +10,18 @@ - + - - + + diff --git a/src/vs/editor/browser/widget/diffEditorWidget.ts b/src/vs/editor/browser/widget/diffEditorWidget.ts index 3c20fb0231..def04ab469 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget.ts @@ -132,7 +132,7 @@ class VisualEditorState { this._zonesMap[String(zoneId)] = true; if (newDecorations.zones[i].diff && viewZone.marginDomNode) { - this.inlineDiffMargins.push(new InlineDiffMargin(viewZone.marginDomNode, editor, newDecorations.zones[i].diff!, this._contextMenuService, this._clipboardService)); + this.inlineDiffMargins.push(new InlineDiffMargin(zoneId, viewZone.marginDomNode, editor, newDecorations.zones[i].diff!, this._contextMenuService, this._clipboardService)); } } }); diff --git a/src/vs/editor/browser/widget/inlineDiffMargin.ts b/src/vs/editor/browser/widget/inlineDiffMargin.ts index b26e5a2958..2d1748d0d0 100644 --- a/src/vs/editor/browser/widget/inlineDiffMargin.ts +++ b/src/vs/editor/browser/widget/inlineDiffMargin.ts @@ -9,6 +9,7 @@ import { Action } from 'vs/base/common/actions'; import { Disposable } from 'vs/base/common/lifecycle'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; +import * as editorBrowser from 'vs/editor/browser/editorBrowser'; import { Range } from 'vs/editor/common/core/range'; import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget'; @@ -21,10 +22,29 @@ export interface IDiffLinesChange { } export class InlineDiffMargin extends Disposable { - private readonly _lightBulb: HTMLElement; + private readonly _diffActions: HTMLElement; + + private _visibility: boolean = false; + + get visibility(): boolean { + return this._visibility; + } + + set visibility(_visibility: boolean) { + if (this._visibility !== _visibility) { + this._visibility = _visibility; + + if (_visibility) { + this._diffActions.style.visibility = 'visible'; + } else { + this._diffActions.style.visibility = 'hidden'; + } + } + } constructor( - marginDomNode: HTMLElement, + private _viewZoneId: string, + private _marginDomNode: HTMLElement, public editor: CodeEditorWidget, public diff: IDiffLinesChange, private _contextMenuService: IContextMenuService, @@ -33,17 +53,18 @@ export class InlineDiffMargin extends Disposable { super(); // make sure the diff margin shows above overlay. - marginDomNode.style.zIndex = '10'; + this._marginDomNode.style.zIndex = '10'; - this._lightBulb = document.createElement('div'); - this._lightBulb.className = 'lightbulb-glyph'; - this._lightBulb.style.position = 'absolute'; + this._diffActions = document.createElement('div'); + this._diffActions.className = 'lightbulb-glyph'; + this._diffActions.style.position = 'absolute'; const lineHeight = editor.getConfiguration().lineHeight; const lineFeed = editor.getModel()!.getEOL(); - this._lightBulb.style.right = '0px'; - this._lightBulb.style.visibility = 'hidden'; - this._lightBulb.style.height = `${lineHeight}px`; - marginDomNode.appendChild(this._lightBulb); + this._diffActions.style.right = '0px'; + this._diffActions.style.visibility = 'hidden'; + this._diffActions.style.height = `${lineHeight}px`; + this._diffActions.style.lineHeight = `${lineHeight}px`; + this._marginDomNode.appendChild(this._diffActions); const actions = [ new Action( @@ -59,17 +80,21 @@ export class InlineDiffMargin extends Disposable { let currentLineNumberOffset = 0; - const copyLineAction = new Action( - 'diff.clipboard.copyDeletedLineContent', - nls.localize('diff.clipboard.copyDeletedLineContent.label', "Copy deleted line {0} content to clipboard", diff.originalStartLineNumber), - undefined, - true, - async () => { - await this._clipboardService.writeText(diff.originalContent[currentLineNumberOffset]); - } - ); + let copyLineAction: Action | undefined = undefined; - actions.push(copyLineAction); + if (diff.originalEndLineNumber > diff.modifiedStartLineNumber) { + copyLineAction = new Action( + 'diff.clipboard.copyDeletedLineContent', + nls.localize('diff.clipboard.copyDeletedLineContent.label', "Copy deleted line {0} content to clipboard", diff.originalStartLineNumber), + undefined, + true, + async () => { + await this._clipboardService.writeText(diff.originalContent[currentLineNumberOffset]); + } + ); + + actions.push(copyLineAction); + } const readOnly = editor.getConfiguration().readOnly; if (!readOnly) { @@ -96,21 +121,8 @@ export class InlineDiffMargin extends Disposable { })); } - this._register(dom.addStandardDisposableListener(marginDomNode, 'mouseenter', e => { - this._lightBulb.style.visibility = 'visible'; - currentLineNumberOffset = this._updateLightBulbPosition(marginDomNode, e.y, lineHeight); - })); - - this._register(dom.addStandardDisposableListener(marginDomNode, 'mouseleave', e => { - this._lightBulb.style.visibility = 'hidden'; - })); - - this._register(dom.addStandardDisposableListener(marginDomNode, 'mousemove', e => { - currentLineNumberOffset = this._updateLightBulbPosition(marginDomNode, e.y, lineHeight); - })); - - this._register(dom.addStandardDisposableListener(this._lightBulb, 'mousedown', e => { - const { top, height } = dom.getDomNodePagePosition(this._lightBulb); + this._register(dom.addStandardDisposableListener(this._diffActions, 'mousedown', e => { + const { top, height } = dom.getDomNodePagePosition(this._diffActions); let pad = Math.floor(lineHeight / 3) + lineHeight; this._contextMenuService.showContextMenu({ getAnchor: () => { @@ -120,12 +132,29 @@ export class InlineDiffMargin extends Disposable { }; }, getActions: () => { - copyLineAction.label = nls.localize('diff.clipboard.copyDeletedLineContent.label', "Copy deleted line {0} content to clipboard", diff.originalStartLineNumber + currentLineNumberOffset); + if (copyLineAction) { + copyLineAction.label = nls.localize('diff.clipboard.copyDeletedLineContent.label', "Copy deleted line {0} content to clipboard", diff.originalStartLineNumber + currentLineNumberOffset); + } return actions; }, autoSelectFirstItem: true }); })); + + this._register(editor.onMouseMove((e: editorBrowser.IEditorMouseEvent) => { + if (e.target.type === editorBrowser.MouseTargetType.CONTENT_VIEW_ZONE || e.target.type === editorBrowser.MouseTargetType.GUTTER_VIEW_ZONE) { + const viewZoneId = e.target.detail.viewZoneId; + + if (viewZoneId === this._viewZoneId) { + this.visibility = true; + currentLineNumberOffset = this._updateLightBulbPosition(this._marginDomNode, e.event.browserEvent.y, lineHeight); + } else { + this.visibility = false; + } + } else { + this.visibility = false; + } + })); } private _updateLightBulbPosition(marginDomNode: HTMLElement, y: number, lineHeight: number): number { @@ -133,7 +162,7 @@ export class InlineDiffMargin extends Disposable { const offset = y - top; const lineNumberOffset = Math.floor(offset / lineHeight); const newTop = lineNumberOffset * lineHeight; - this._lightBulb.style.top = `${newTop}px`; + this._diffActions.style.top = `${newTop}px`; return lineNumberOffset; } } diff --git a/src/vs/editor/browser/widget/media/diffEditor.css b/src/vs/editor/browser/widget/media/diffEditor.css index 63da0de9ad..55f5d9b785 100644 --- a/src/vs/editor/browser/widget/media/diffEditor.css +++ b/src/vs/editor/browser/widget/media/diffEditor.css @@ -93,3 +93,16 @@ .monaco-editor .view-zones .view-lines .view-line span { display: inline-block; } + +.monaco-editor .margin-view-zones .inline-deleted-margin-view-zone .lightbulb-glyph { + background: url('lightbulb-light.svg') center center no-repeat; +} + +.monaco-editor.vs-dark .margin-view-zones .inline-deleted-margin-view-zone .lightbulb-glyph, +.monaco-editor.hc-dark .margin-view-zones .inline-deleted-margin-view-zone .lightbulb-glyph { + background: url('lightbulb-dark.svg') center center no-repeat; +} + +.monaco-editor .margin-view-zones .lightbulb-glyph:hover { + cursor: pointer; +} diff --git a/src/vs/editor/browser/widget/media/lightbulb-dark.svg b/src/vs/editor/browser/widget/media/lightbulb-dark.svg new file mode 100644 index 0000000000..5fe8931a81 --- /dev/null +++ b/src/vs/editor/browser/widget/media/lightbulb-dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/vs/editor/browser/widget/media/lightbulb-light.svg b/src/vs/editor/browser/widget/media/lightbulb-light.svg new file mode 100644 index 0000000000..191c566fd2 --- /dev/null +++ b/src/vs/editor/browser/widget/media/lightbulb-light.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index c518523da5..f14d4a28c2 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -558,6 +558,17 @@ const editorConfiguration: IConfigurationNode = { 'default': EDITOR_DEFAULTS.autoClosingQuotes, 'description': nls.localize('autoClosingQuotes', "Controls whether the editor should automatically close quotes after the user adds an opening quote.") }, + 'editor.autoClosingOvertype': { + type: 'string', + enum: ['always', 'auto', 'never'], + enumDescriptions: [ + nls.localize('editor.autoClosingOvertype.always', "Always type over closing quotes or brackets."), + nls.localize('editor.autoClosingOvertype.auto', "Type over closing quotes or brackets only if they were automatically inserted."), + nls.localize('editor.autoClosingOvertype.never', "Never type over closing quotes or brackets."), + ], + 'default': EDITOR_DEFAULTS.autoClosingOvertype, + 'description': nls.localize('autoClosingOvertype', "Controls whether the editor should type over closing quotes or brackets.") + }, 'editor.autoSurround': { type: 'string', enum: ['languageDefined', 'brackets', 'quotes', 'never'], diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index dc5725a80f..7b731eb3d3 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -108,6 +108,11 @@ export type EditorAutoClosingStrategy = 'always' | 'languageDefined' | 'beforeWh */ export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never'; +/** + * Configuration options for typing over closing quotes or brackets + */ +export type EditorAutoClosingOvertypeStrategy = 'always' | 'auto' | 'never'; + /** * Configuration options for editor minimap */ @@ -544,6 +549,10 @@ export interface IEditorOptions { * Defaults to language defined behavior. */ autoClosingQuotes?: EditorAutoClosingStrategy; + /** + * Options for typing over closing quotes or brackets. + */ + autoClosingOvertype?: EditorAutoClosingOvertypeStrategy; /** * Options for auto surrounding. * Defaults to always allowing auto surrounding. @@ -1079,6 +1088,7 @@ export interface IValidatedEditorOptions { readonly wordWrapBreakObtrusiveCharacters: string; readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy; + readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy; readonly autoSurround: EditorAutoSurroundStrategy; readonly autoIndent: boolean; readonly dragAndDrop: boolean; @@ -1117,6 +1127,7 @@ export class InternalEditorOptions { readonly wordSeparators: string; readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy; + readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy; readonly autoSurround: EditorAutoSurroundStrategy; readonly autoIndent: boolean; readonly useTabStops: boolean; @@ -1147,6 +1158,7 @@ export class InternalEditorOptions { wordSeparators: string; autoClosingBrackets: EditorAutoClosingStrategy; autoClosingQuotes: EditorAutoClosingStrategy; + autoClosingOvertype: EditorAutoClosingOvertypeStrategy; autoSurround: EditorAutoSurroundStrategy; autoIndent: boolean; useTabStops: boolean; @@ -1172,6 +1184,7 @@ export class InternalEditorOptions { this.wordSeparators = source.wordSeparators; this.autoClosingBrackets = source.autoClosingBrackets; this.autoClosingQuotes = source.autoClosingQuotes; + this.autoClosingOvertype = source.autoClosingOvertype; this.autoSurround = source.autoSurround; this.autoIndent = source.autoIndent; this.useTabStops = source.useTabStops; @@ -1203,6 +1216,7 @@ export class InternalEditorOptions { && this.wordSeparators === other.wordSeparators && this.autoClosingBrackets === other.autoClosingBrackets && this.autoClosingQuotes === other.autoClosingQuotes + && this.autoClosingOvertype === other.autoClosingOvertype && this.autoSurround === other.autoSurround && this.autoIndent === other.autoIndent && this.useTabStops === other.useTabStops @@ -1235,6 +1249,7 @@ export class InternalEditorOptions { wordSeparators: (this.wordSeparators !== newOpts.wordSeparators), autoClosingBrackets: (this.autoClosingBrackets !== newOpts.autoClosingBrackets), autoClosingQuotes: (this.autoClosingQuotes !== newOpts.autoClosingQuotes), + autoClosingOvertype: (this.autoClosingOvertype !== newOpts.autoClosingOvertype), autoSurround: (this.autoSurround !== newOpts.autoSurround), autoIndent: (this.autoIndent !== newOpts.autoIndent), useTabStops: (this.useTabStops !== newOpts.useTabStops), @@ -1640,6 +1655,7 @@ export interface IConfigurationChangedEvent { readonly wordSeparators: boolean; readonly autoClosingBrackets: boolean; readonly autoClosingQuotes: boolean; + readonly autoClosingOvertype: boolean; readonly autoSurround: boolean; readonly autoIndent: boolean; readonly useTabStops: boolean; @@ -1852,6 +1868,7 @@ export class EditorOptionsValidator { wordWrapBreakObtrusiveCharacters: _string(opts.wordWrapBreakObtrusiveCharacters, defaults.wordWrapBreakObtrusiveCharacters), autoClosingBrackets, autoClosingQuotes, + autoClosingOvertype: _stringSet(opts.autoClosingOvertype, defaults.autoClosingOvertype, ['always', 'auto', 'never']), autoSurround, autoIndent: _boolean(opts.autoIndent, defaults.autoIndent), dragAndDrop: _boolean(opts.dragAndDrop, defaults.dragAndDrop), @@ -2148,7 +2165,6 @@ export class EditorOptionsValidator { export class InternalEditorOptionsFactory { private static _tweakValidatedOptions(opts: IValidatedEditorOptions, accessibilitySupport: AccessibilitySupport): IValidatedEditorOptions { - const accessibilityIsOn = (accessibilitySupport === AccessibilitySupport.Enabled); const accessibilityIsOff = (accessibilitySupport === AccessibilitySupport.Disabled); return { inDiffEditor: opts.inDiffEditor, @@ -2168,6 +2184,7 @@ export class InternalEditorOptionsFactory { wordWrapBreakObtrusiveCharacters: opts.wordWrapBreakObtrusiveCharacters, autoClosingBrackets: opts.autoClosingBrackets, autoClosingQuotes: opts.autoClosingQuotes, + autoClosingOvertype: opts.autoClosingOvertype, autoSurround: opts.autoSurround, autoIndent: opts.autoIndent, dragAndDrop: opts.dragAndDrop, @@ -2244,7 +2261,7 @@ export class InternalEditorOptionsFactory { selectionHighlight: opts.contribInfo.selectionHighlight, occurrencesHighlight: opts.contribInfo.occurrencesHighlight, codeLens: opts.contribInfo.codeLens, - folding: (accessibilityIsOn ? false : opts.contribInfo.folding), // DISABLED WHEN SCREEN READER IS ATTACHED + folding: opts.contribInfo.folding, foldingStrategy: opts.contribInfo.foldingStrategy, showFoldingControls: opts.contribInfo.showFoldingControls, matchBrackets: opts.contribInfo.matchBrackets, @@ -2396,6 +2413,7 @@ export class InternalEditorOptionsFactory { wordSeparators: opts.wordSeparators, autoClosingBrackets: opts.autoClosingBrackets, autoClosingQuotes: opts.autoClosingQuotes, + autoClosingOvertype: opts.autoClosingOvertype, autoSurround: opts.autoSurround, autoIndent: opts.autoIndent, useTabStops: opts.useTabStops, @@ -2635,6 +2653,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = { wordWrapBreakObtrusiveCharacters: '.', autoClosingBrackets: 'languageDefined', autoClosingQuotes: 'languageDefined', + autoClosingOvertype: 'auto', autoSurround: 'languageDefined', autoIndent: true, dragAndDrop: true, diff --git a/src/vs/editor/common/controller/cursorCommon.ts b/src/vs/editor/common/controller/cursorCommon.ts index 8c733dd015..2860c6b6b0 100644 --- a/src/vs/editor/common/controller/cursorCommon.ts +++ b/src/vs/editor/common/controller/cursorCommon.ts @@ -6,7 +6,7 @@ import { CharCode } from 'vs/base/common/charCode'; import { onUnexpectedError } from 'vs/base/common/errors'; import * as strings from 'vs/base/common/strings'; -import { EditorAutoClosingStrategy, EditorAutoSurroundStrategy, IConfigurationChangedEvent } from 'vs/editor/common/config/editorOptions'; +import { EditorAutoClosingStrategy, EditorAutoSurroundStrategy, IConfigurationChangedEvent, EditorAutoClosingOvertypeStrategy } from 'vs/editor/common/config/editorOptions'; import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; @@ -99,6 +99,7 @@ export class CursorConfiguration { public readonly multiCursorMergeOverlapping: boolean; public readonly autoClosingBrackets: EditorAutoClosingStrategy; public readonly autoClosingQuotes: EditorAutoClosingStrategy; + public readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy; public readonly autoSurround: EditorAutoSurroundStrategy; public readonly autoIndent: boolean; public readonly autoClosingPairsOpen2: Map; @@ -117,6 +118,7 @@ export class CursorConfiguration { || e.multiCursorMergeOverlapping || e.autoClosingBrackets || e.autoClosingQuotes + || e.autoClosingOvertype || e.autoSurround || e.useTabStops || e.lineHeight @@ -146,6 +148,7 @@ export class CursorConfiguration { this.multiCursorMergeOverlapping = c.multiCursorMergeOverlapping; this.autoClosingBrackets = c.autoClosingBrackets; this.autoClosingQuotes = c.autoClosingQuotes; + this.autoClosingOvertype = c.autoClosingOvertype; this.autoSurround = c.autoSurround; this.autoIndent = c.autoIndent; diff --git a/src/vs/editor/common/controller/cursorTypeOperations.ts b/src/vs/editor/common/controller/cursorTypeOperations.ts index 45de4b2cf6..d08ebd078f 100644 --- a/src/vs/editor/common/controller/cursorTypeOperations.ts +++ b/src/vs/editor/common/controller/cursorTypeOperations.ts @@ -431,10 +431,8 @@ export class TypeOperations { return null; } - private static _isAutoClosingCloseCharType(config: CursorConfiguration, model: ITextModel, selections: Selection[], autoClosedCharacters: Range[], ch: string): boolean { - const autoCloseConfig = isQuote(ch) ? config.autoClosingQuotes : config.autoClosingBrackets; - - if (autoCloseConfig === 'never') { + private static _isAutoClosingOvertype(config: CursorConfiguration, model: ITextModel, selections: Selection[], autoClosedCharacters: Range[], ch: string): boolean { + if (config.autoClosingOvertype === 'never') { return false; } @@ -458,23 +456,25 @@ export class TypeOperations { } // Must over-type a closing character typed by the editor - let found = false; - for (let j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) { - const autoClosedCharacter = autoClosedCharacters[j]; - if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) { - found = true; - break; + if (config.autoClosingOvertype === 'auto') { + let found = false; + for (let j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) { + const autoClosedCharacter = autoClosedCharacters[j]; + if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) { + found = true; + break; + } + } + if (!found) { + return false; } - } - if (!found) { - return false; } } return true; } - private static _runAutoClosingCloseCharType(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ITextModel, selections: Selection[], ch: string): EditOperationResult { + private static _runAutoClosingOvertype(prevEditOperationType: EditOperationType, config: CursorConfiguration, model: ITextModel, selections: Selection[], ch: string): EditOperationResult { let commands: ICommand[] = []; for (let i = 0, len = selections.length; i < len; i++) { const selection = selections[i]; @@ -765,7 +765,7 @@ export class TypeOperations { return null; } - if (this._isAutoClosingCloseCharType(config, model, selections, autoClosedCharacters, ch)) { + if (this._isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) { // Unfortunately, the close character is at this point "doubled", so we need to delete it... const commands = selections.map(s => new ReplaceCommand(new Range(s.positionLineNumber, s.positionColumn, s.positionLineNumber, s.positionColumn + 1), '', false)); return new EditOperationResult(EditOperationType.Typing, commands, { @@ -813,8 +813,8 @@ export class TypeOperations { } } - if (this._isAutoClosingCloseCharType(config, model, selections, autoClosedCharacters, ch)) { - return this._runAutoClosingCloseCharType(prevEditOperationType, config, model, selections, ch); + if (this._isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) { + return this._runAutoClosingOvertype(prevEditOperationType, config, model, selections, ch); } const autoClosingPairOpenCharType = this._isAutoClosingOpenCharType(config, model, selections, ch, true); diff --git a/src/vs/editor/common/controller/cursorWordOperations.ts b/src/vs/editor/common/controller/cursorWordOperations.ts index c99916ab37..d3ddf0fe9a 100644 --- a/src/vs/editor/common/controller/cursorWordOperations.ts +++ b/src/vs/editor/common/controller/cursorWordOperations.ts @@ -39,7 +39,8 @@ const enum WordType { export const enum WordNavigationType { WordStart = 0, WordStartFast = 1, - WordEnd = 2 + WordEnd = 2, + WordAccessibility = 3 // Respect chrome defintion of a word } export class WordOperations { @@ -202,6 +203,18 @@ export class WordOperations { return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1); } + if (wordNavigationType === WordNavigationType.WordAccessibility) { + while ( + prevWordOnLine + && prevWordOnLine.wordType === WordType.Separator + ) { + // Skip over words made up of only separators + prevWordOnLine = WordOperations._findPreviousWordOnLine(wordSeparators, model, new Position(lineNumber, prevWordOnLine.start + 1)); + } + + return new Position(lineNumber, prevWordOnLine ? prevWordOnLine.start + 1 : 1); + } + // We are stopping at the ending of words if (prevWordOnLine && column <= prevWordOnLine.end + 1) { @@ -270,6 +283,21 @@ export class WordOperations { nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1)); } } + if (nextWordOnLine) { + column = nextWordOnLine.end + 1; + } else { + column = model.getLineMaxColumn(lineNumber); + } + } else if (wordNavigationType === WordNavigationType.WordAccessibility) { + + while ( + nextWordOnLine + && nextWordOnLine.wordType === WordType.Separator + ) { + // Skip over a word made up of one single separator + nextWordOnLine = WordOperations._findNextWordOnLine(wordSeparators, model, new Position(lineNumber, nextWordOnLine.end + 1)); + } + if (nextWordOnLine) { column = nextWordOnLine.end + 1; } else { @@ -617,4 +645,4 @@ export class WordPartOperations extends WordOperations { function enforceDefined(arr: Array): T[] { return arr.filter(el => Boolean(el)); -} \ No newline at end of file +} diff --git a/src/vs/editor/common/modes/textToHtmlTokenizer.ts b/src/vs/editor/common/modes/textToHtmlTokenizer.ts index 25dc1a43b6..2bfb6570dd 100644 --- a/src/vs/editor/common/modes/textToHtmlTokenizer.ts +++ b/src/vs/editor/common/modes/textToHtmlTokenizer.ts @@ -78,7 +78,7 @@ export function tokenizeLineToHTML(text: string, viewLineTokens: IViewLineTokens break; case CharCode.Space: - partContent += ' '; + partContent += ' '; break; default: diff --git a/src/vs/editor/contrib/find/findWidget.css b/src/vs/editor/contrib/find/findWidget.css index a2a3987e79..a576b6fde3 100644 --- a/src/vs/editor/contrib/find/findWidget.css +++ b/src/vs/editor/contrib/find/findWidget.css @@ -38,6 +38,7 @@ line-height: 19px; transition: top 200ms linear; padding: 0 4px; + box-sizing: border-box; } .monaco-editor .find-widget.hiddenEditor { diff --git a/src/vs/editor/contrib/find/findWidget.ts b/src/vs/editor/contrib/find/findWidget.ts index b4f70da0f7..54161f62b9 100644 --- a/src/vs/editor/contrib/find/findWidget.ts +++ b/src/vs/editor/contrib/find/findWidget.ts @@ -57,7 +57,7 @@ const NLS_MATCHES_COUNT_LIMIT_TITLE = nls.localize('title.matchesCountLimit', "O const NLS_MATCHES_LOCATION = nls.localize('label.matchesLocation', "{0} of {1}"); const NLS_NO_RESULTS = nls.localize('label.noResults', "No Results"); -const FIND_WIDGET_INITIAL_WIDTH = 411; +const FIND_WIDGET_INITIAL_WIDTH = 419; const PART_WIDTH = 275; const FIND_INPUT_AREA_WIDTH = PART_WIDTH - 54; @@ -1172,6 +1172,39 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas this._findInput.inputBox.layout(); this._tryUpdateHeight(); })); + + this._register(this._resizeSash.onDidReset(() => { + // users double click on the sash + const currentWidth = dom.getTotalWidth(this._domNode); + + if (currentWidth < FIND_WIDGET_INITIAL_WIDTH) { + // The editor is narrow and the width of the find widget is controlled fully by CSS. + return; + } + + let width = FIND_WIDGET_INITIAL_WIDTH; + + if (!this._resized || currentWidth === FIND_WIDGET_INITIAL_WIDTH) { + // 1. never resized before, double click should maximizes it + // 2. users resized it already but its width is the same as default + width = this._codeEditor.getConfiguration().layoutInfo.width - 28 - this._codeEditor.getConfiguration().layoutInfo.minimapWidth - 15; + this._resized = true; + } else { + /** + * no op, the find widget should be shrinked to its default size. + */ + } + + const inputBoxWidth = width - FIND_ALL_CONTROLS_WIDTH; + + this._domNode.style.width = `${width}px`; + this._findInput.inputBox.width = inputBoxWidth; + if (this._isReplaceVisible) { + this._replaceInput.width = dom.getTotalWidth(this._findInput.domNode); + } + + this._findInput.inputBox.layout(); + })); } private updateAccessibilitySupport(): void { diff --git a/src/vs/editor/contrib/suggest/suggestController.ts b/src/vs/editor/contrib/suggest/suggestController.ts index 078bf09208..12d054803b 100644 --- a/src/vs/editor/contrib/suggest/suggestController.ts +++ b/src/vs/editor/contrib/suggest/suggestController.ts @@ -7,7 +7,7 @@ import { alert } from 'vs/base/browser/ui/aria/aria'; import { isNonEmptyArray } from 'vs/base/common/arrays'; import { onUnexpectedError } from 'vs/base/common/errors'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; -import { dispose, IDisposable, DisposableStore, toDisposable } from 'vs/base/common/lifecycle'; +import { dispose, IDisposable, DisposableStore, toDisposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { EditorAction, EditorCommand, registerEditorAction, registerEditorCommand, registerEditorContribution, ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { EditOperation } from 'vs/editor/common/core/editOperation'; @@ -33,9 +33,49 @@ import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerServ import { IdleValue } from 'vs/base/common/async'; import { isObject } from 'vs/base/common/types'; import { CommitCharacterController } from './suggestCommitCharacters'; +import { IPosition } from 'vs/editor/common/core/position'; +import { TrackedRangeStickiness, ITextModel } from 'vs/editor/common/model'; const _sticky = false; // for development purposes only +class LineSuffix { + + private readonly _marker: string[] | undefined; + + constructor(private readonly _model: ITextModel, private readonly _position: IPosition) { + // spy on what's happening right of the cursor. two cases: + // 1. end of line -> check that it's still end of line + // 2. mid of line -> add a marker and compute the delta + const maxColumn = _model.getLineMaxColumn(_position.lineNumber); + if (maxColumn !== _position.column) { + const offset = _model.getOffsetAt(_position); + const end = _model.getPositionAt(offset + 1); + this._marker = _model.deltaDecorations([], [{ + range: Range.fromPositions(_position, end), + options: { stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges } + }]); + } + } + + dispose(): void { + if (this._marker) { + this._model.deltaDecorations(this._marker, []); + } + } + + delta(position: IPosition): number { + if (this._position.lineNumber !== position.lineNumber) { + return 0; + } else if (this._marker) { + const range = this._model.getDecorationRange(this._marker[0]); + const end = this._model.getOffsetAt(range!.getStartPosition()); + return end - this._model.getOffsetAt(position); + } else { + return this._model.getLineMaxColumn(position.lineNumber) - position.column; + } + } +} + export class SuggestController implements IEditorContribution { private static readonly ID: string = 'editor.contrib.suggestController'; @@ -47,9 +87,9 @@ export class SuggestController implements IEditorContribution { private readonly _model: SuggestModel; private readonly _widget: IdleValue; private readonly _alternatives: IdleValue; + private readonly _lineSuffix = new MutableDisposable(); private readonly _toDispose = new DisposableStore(); - constructor( private _editor: ICodeEditor, @IEditorWorkerService editorWorker: IEditorWorkerService, @@ -115,6 +155,7 @@ export class SuggestController implements IEditorContribution { this._toDispose.add(this._model.onDidTrigger(e => { this._widget.getValue().showTriggered(e.auto, e.shy ? 250 : 50); + this._lineSuffix.value = new LineSuffix(this._editor.getModel()!, e.position); })); this._toDispose.add(this._model.onDidSuggest(e => { if (!e.shy) { @@ -123,7 +164,7 @@ export class SuggestController implements IEditorContribution { } })); this._toDispose.add(this._model.onDidCancel(e => { - if (this._widget && !e.retrigger) { + if (!e.retrigger) { this._widget.getValue().hideWidget(); } })); @@ -154,6 +195,7 @@ export class SuggestController implements IEditorContribution { this._toDispose.dispose(); this._widget.dispose(); this._model.dispose(); + this._lineSuffix.dispose(); } protected _insertSuggestion(event: ISelectedSuggestion | undefined, keepAlternativeSuggestions: boolean, undoStops: boolean): void { @@ -193,10 +235,11 @@ export class SuggestController implements IEditorContribution { const overwriteBefore = position.column - suggestion.range.startColumn; const overwriteAfter = suggestion.range.endColumn - position.column; + const suffixDelta = this._lineSuffix.value ? this._lineSuffix.value.delta(this._editor.getPosition()) : 0; SnippetController2.get(this._editor).insert(insertText, { overwriteBefore: overwriteBefore + columnDelta, - overwriteAfter, + overwriteAfter: overwriteAfter + suffixDelta, undoStopBefore: false, undoStopAfter: false, adjustWhitespace: !(suggestion.insertTextRules! & CompletionItemInsertTextRule.KeepWhitespace) diff --git a/src/vs/editor/contrib/suggest/suggestModel.ts b/src/vs/editor/contrib/suggest/suggestModel.ts index a483b270a1..6356716f27 100644 --- a/src/vs/editor/contrib/suggest/suggestModel.ts +++ b/src/vs/editor/contrib/suggest/suggestModel.ts @@ -10,7 +10,7 @@ import { Emitter, Event } from 'vs/base/common/event'; import { IDisposable, dispose, DisposableStore, isDisposable } from 'vs/base/common/lifecycle'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { CursorChangeReason, ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursorEvents'; -import { Position } from 'vs/editor/common/core/position'; +import { Position, IPosition } from 'vs/editor/common/core/position'; import { Selection } from 'vs/editor/common/core/selection'; import { ITextModel, IWordAtPosition } from 'vs/editor/common/model'; import { CompletionItemProvider, StandardTokenType, CompletionContext, CompletionProviderRegistry, CompletionTriggerKind, CompletionItemKind, completionKindFromString } from 'vs/editor/common/modes'; @@ -28,6 +28,7 @@ export interface ICancelEvent { export interface ITriggerEvent { readonly auto: boolean; readonly shy: boolean; + readonly position: IPosition; } export interface ISuggestEvent { @@ -365,7 +366,7 @@ export class SuggestModel implements IDisposable { // Cancel previous requests, change state & update UI this.cancel(retrigger); this._state = auto ? State.Auto : State.Manual; - this._onDidTrigger.fire({ auto, shy: context.shy }); + this._onDidTrigger.fire({ auto, shy: context.shy, position: this._editor.getPosition() }); // Capture context when request was sent this._context = ctx; diff --git a/src/vs/editor/contrib/wordOperations/test/wordOperations.test.ts b/src/vs/editor/contrib/wordOperations/test/wordOperations.test.ts index 78225b3d0c..41aa36e8ab 100644 --- a/src/vs/editor/contrib/wordOperations/test/wordOperations.test.ts +++ b/src/vs/editor/contrib/wordOperations/test/wordOperations.test.ts @@ -9,7 +9,7 @@ import { EditorCommand } from 'vs/editor/browser/editorExtensions'; import { Position } from 'vs/editor/common/core/position'; import { Selection } from 'vs/editor/common/core/selection'; import { deserializePipePositions, serializePipePositions, testRepeatedActionAndExtractPositions } from 'vs/editor/contrib/wordOperations/test/wordTestUtils'; -import { CursorWordEndLeft, CursorWordEndLeftSelect, CursorWordEndRight, CursorWordEndRightSelect, CursorWordLeft, CursorWordLeftSelect, CursorWordRight, CursorWordRightSelect, CursorWordStartLeft, CursorWordStartLeftSelect, CursorWordStartRight, CursorWordStartRightSelect, DeleteWordEndLeft, DeleteWordEndRight, DeleteWordLeft, DeleteWordRight, DeleteWordStartLeft, DeleteWordStartRight } from 'vs/editor/contrib/wordOperations/wordOperations'; +import { CursorWordEndLeft, CursorWordEndLeftSelect, CursorWordEndRight, CursorWordEndRightSelect, CursorWordLeft, CursorWordLeftSelect, CursorWordRight, CursorWordRightSelect, CursorWordStartLeft, CursorWordStartLeftSelect, CursorWordStartRight, CursorWordStartRightSelect, DeleteWordEndLeft, DeleteWordEndRight, DeleteWordLeft, DeleteWordRight, DeleteWordStartLeft, DeleteWordStartRight, CursorWordAccessibilityLeft, CursorWordAccessibilityLeftSelect, CursorWordAccessibilityRight, CursorWordAccessibilityRightSelect } from 'vs/editor/contrib/wordOperations/wordOperations'; import { withTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor'; suite('WordOperations', () => { @@ -26,6 +26,10 @@ suite('WordOperations', () => { const _cursorWordStartRightSelect = new CursorWordStartRightSelect(); const _cursorWordEndRightSelect = new CursorWordEndRightSelect(); const _cursorWordRightSelect = new CursorWordRightSelect(); + const _cursorWordAccessibilityLeft = new CursorWordAccessibilityLeft(); + const _cursorWordAccessibilityLeftSelect = new CursorWordAccessibilityLeftSelect(); + const _cursorWordAccessibilityRight = new CursorWordAccessibilityRight(); + const _cursorWordAccessibilityRightSelect = new CursorWordAccessibilityRightSelect(); const _deleteWordLeft = new DeleteWordLeft(); const _deleteWordStartLeft = new DeleteWordStartLeft(); const _deleteWordEndLeft = new DeleteWordEndLeft(); @@ -39,6 +43,12 @@ suite('WordOperations', () => { function cursorWordLeft(editor: ICodeEditor, inSelectionMode: boolean = false): void { runEditorCommand(editor, inSelectionMode ? _cursorWordLeftSelect : _cursorWordLeft); } + function cursorWordAccessibilityLeft(editor: ICodeEditor, inSelectionMode: boolean = false): void { + runEditorCommand(editor, inSelectionMode ? _cursorWordAccessibilityLeft : _cursorWordAccessibilityLeftSelect); + } + function cursorWordAccessibilityRight(editor: ICodeEditor, inSelectionMode: boolean = false): void { + runEditorCommand(editor, inSelectionMode ? _cursorWordAccessibilityRightSelect : _cursorWordAccessibilityRight); + } function cursorWordStartLeft(editor: ICodeEditor, inSelectionMode: boolean = false): void { runEditorCommand(editor, inSelectionMode ? _cursorWordStartLeftSelect : _cursorWordStartLeft); } @@ -326,6 +336,34 @@ suite('WordOperations', () => { assert.deepEqual(actual, EXPECTED); }); + test('cursorWordAccessibilityLeft', () => { + const EXPECTED = ['| /* |Just |some |more |text |a+= |3 +|5-|3 + |7 */ '].join('\n'); + const [text,] = deserializePipePositions(EXPECTED); + const actualStops = testRepeatedActionAndExtractPositions( + text, + new Position(1000, 1000), + ed => cursorWordAccessibilityLeft(ed), + ed => ed.getPosition()!, + ed => ed.getPosition()!.equals(new Position(1, 1)) + ); + const actual = serializePipePositions(text, actualStops); + assert.deepEqual(actual, EXPECTED); + }); + + test('cursorWordAccessibilityRight', () => { + const EXPECTED = [' /* Just| some| more| text| a|+= 3| +5|-3| + 7| */ |'].join('\n'); + const [text,] = deserializePipePositions(EXPECTED); + const actualStops = testRepeatedActionAndExtractPositions( + text, + new Position(1, 1), + ed => cursorWordAccessibilityRight(ed), + ed => ed.getPosition()!, + ed => ed.getPosition()!.equals(new Position(1, 50)) + ); + const actual = serializePipePositions(text, actualStops); + assert.deepEqual(actual, EXPECTED); + }); + test('deleteWordLeft for non-empty selection', () => { withTestCodeEditor([ ' \tMy First Line\t ', diff --git a/src/vs/editor/contrib/wordOperations/wordOperations.ts b/src/vs/editor/contrib/wordOperations/wordOperations.ts index ab9301c627..2830d0809d 100644 --- a/src/vs/editor/contrib/wordOperations/wordOperations.ts +++ b/src/vs/editor/contrib/wordOperations/wordOperations.ts @@ -18,6 +18,9 @@ import { ScrollType } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ITextModel } from 'vs/editor/common/model'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; +import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vs/platform/accessibility/common/accessibility'; +import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; +import { EDITOR_DEFAULTS } from 'vs/editor/common/config/editorOptions'; export interface MoveWordOptions extends ICommandOptions { inSelectionMode: boolean; @@ -170,6 +173,48 @@ export class CursorWordLeftSelect extends WordLeftCommand { } } +export class CursorWordAccessibilityLeft extends WordLeftCommand { + constructor() { + super({ + inSelectionMode: false, + wordNavigationType: WordNavigationType.WordAccessibility, + id: 'cursorWordAccessibilityLeft', + precondition: undefined, + kbOpts: { + kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, CONTEXT_ACCESSIBILITY_MODE_ENABLED), + primary: KeyMod.CtrlCmd | KeyCode.LeftArrow, + mac: { primary: KeyMod.Alt | KeyCode.LeftArrow }, + weight: KeybindingWeight.EditorContrib + 1 + } + }); + } + + protected _move(_: WordCharacterClassifier, model: ITextModel, position: Position, wordNavigationType: WordNavigationType): Position { + return super._move(getMapForWordSeparators(EDITOR_DEFAULTS.wordSeparators), model, position, wordNavigationType); + } +} + +export class CursorWordAccessibilityLeftSelect extends WordLeftCommand { + constructor() { + super({ + inSelectionMode: true, + wordNavigationType: WordNavigationType.WordAccessibility, + id: 'cursorWordAccessibilitLeftSelecty', + precondition: undefined, + kbOpts: { + kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, CONTEXT_ACCESSIBILITY_MODE_ENABLED), + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.LeftArrow, + mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow }, + weight: KeybindingWeight.EditorContrib + 1 + } + }); + } + + protected _move(_: WordCharacterClassifier, model: ITextModel, position: Position, wordNavigationType: WordNavigationType): Position { + return super._move(getMapForWordSeparators(EDITOR_DEFAULTS.wordSeparators), model, position, wordNavigationType); + } +} + export class CursorWordStartRight extends WordRightCommand { constructor() { super({ @@ -248,6 +293,48 @@ export class CursorWordRightSelect extends WordRightCommand { } } +export class CursorWordAccessibilityRight extends WordRightCommand { + constructor() { + super({ + inSelectionMode: false, + wordNavigationType: WordNavigationType.WordAccessibility, + id: 'cursorWordAccessibilityRight', + precondition: undefined, + kbOpts: { + kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, CONTEXT_ACCESSIBILITY_MODE_ENABLED), + primary: KeyMod.CtrlCmd | KeyCode.RightArrow, + mac: { primary: KeyMod.Alt | KeyCode.RightArrow }, + weight: KeybindingWeight.EditorContrib + 1 + } + }); + } + + protected _move(_: WordCharacterClassifier, model: ITextModel, position: Position, wordNavigationType: WordNavigationType): Position { + return super._move(getMapForWordSeparators(EDITOR_DEFAULTS.wordSeparators), model, position, wordNavigationType); + } +} + +export class CursorWordAccessibilityRightSelect extends WordRightCommand { + constructor() { + super({ + inSelectionMode: true, + wordNavigationType: WordNavigationType.WordAccessibility, + id: 'cursorWordAccessibilityRightSelect', + precondition: undefined, + kbOpts: { + kbExpr: ContextKeyExpr.and(EditorContextKeys.textInputFocus, CONTEXT_ACCESSIBILITY_MODE_ENABLED), + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.RightArrow, + mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow }, + weight: KeybindingWeight.EditorContrib + 1 + } + }); + } + + protected _move(_: WordCharacterClassifier, model: ITextModel, position: Position, wordNavigationType: WordNavigationType): Position { + return super._move(getMapForWordSeparators(EDITOR_DEFAULTS.wordSeparators), model, position, wordNavigationType); + } +} + export interface DeleteWordOptions extends ICommandOptions { whitespaceHeuristics: boolean; wordNavigationType: WordNavigationType; @@ -397,6 +484,10 @@ registerEditorCommand(new CursorWordRight()); registerEditorCommand(new CursorWordStartRightSelect()); registerEditorCommand(new CursorWordEndRightSelect()); registerEditorCommand(new CursorWordRightSelect()); +registerEditorCommand(new CursorWordAccessibilityLeft()); +registerEditorCommand(new CursorWordAccessibilityLeftSelect()); +registerEditorCommand(new CursorWordAccessibilityRight()); +registerEditorCommand(new CursorWordAccessibilityRightSelect()); registerEditorCommand(new DeleteWordStartLeft()); registerEditorCommand(new DeleteWordEndLeft()); registerEditorCommand(new DeleteWordLeft()); diff --git a/src/vs/editor/test/browser/controller/cursor.test.ts b/src/vs/editor/test/browser/controller/cursor.test.ts index b67317a20d..69d67fdb69 100644 --- a/src/vs/editor/test/browser/controller/cursor.test.ts +++ b/src/vs/editor/test/browser/controller/cursor.test.ts @@ -4740,6 +4740,37 @@ suite('autoClosingPairs', () => { mode.dispose(); }); + test('issue #78833 - Add config to use old brackets/quotes overtyping', () => { + let mode = new AutoClosingMode(); + usingCursor({ + text: [ + '', + 'y=();' + ], + languageIdentifier: mode.getLanguageIdentifier(), + editorOpts: { + autoClosingOvertype: 'always' + } + }, (model, cursor) => { + assertCursor(cursor, new Position(1, 1)); + + cursorCommand(cursor, H.Type, { text: 'x=(' }, 'keyboard'); + assert.strictEqual(model.getLineContent(1), 'x=()'); + + cursorCommand(cursor, H.Type, { text: ')' }, 'keyboard'); + assert.strictEqual(model.getLineContent(1), 'x=()'); + + cursor.setSelections('test', [new Selection(1, 4, 1, 4)]); + cursorCommand(cursor, H.Type, { text: ')' }, 'keyboard'); + assert.strictEqual(model.getLineContent(1), 'x=()'); + + cursor.setSelections('test', [new Selection(2, 4, 2, 4)]); + cursorCommand(cursor, H.Type, { text: ')' }, 'keyboard'); + assert.strictEqual(model.getLineContent(2), 'y=();'); + }); + mode.dispose(); + }); + test('issue #15825: accents on mac US intl keyboard', () => { let mode = new AutoClosingMode(); usingCursor({ diff --git a/src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts b/src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts index 3a4b114338..d008e006ea 100644 --- a/src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts +++ b/src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts @@ -109,9 +109,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => { [ '
', 'Ciao', - ' ', + ' ', 'hello', - ' ', + ' ', 'world!', '
' ].join('') @@ -122,9 +122,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => { [ '
', 'Ciao', - ' ', + ' ', 'hello', - ' ', + ' ', 'w', '
' ].join('') @@ -135,9 +135,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => { [ '
', 'Ciao', - ' ', + ' ', 'hello', - ' ', + ' ', '
' ].join('') ); @@ -147,9 +147,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => { [ '
', 'iao', - ' ', + ' ', 'hello', - ' ', + ' ', '
' ].join('') ); @@ -158,9 +158,9 @@ suite('Editor Modes - textToHtmlTokenizer', () => { tokenizeLineToHTML(text, lineTokens, colorMap, 4, 11, 4), [ '
', - ' ', + ' ', 'hello', - ' ', + ' ', '
' ].join('') ); @@ -170,7 +170,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => { [ '
', 'hello', - ' ', + ' ', '
' ].join('') ); @@ -241,11 +241,11 @@ suite('Editor Modes - textToHtmlTokenizer', () => { tokenizeLineToHTML(text, lineTokens, colorMap, 0, 21, 4), [ '
', - '  ', + '  ', 'Ciao', - '   ', + '   ', 'hello', - ' ', + ' ', 'world!', '
' ].join('') @@ -255,11 +255,11 @@ suite('Editor Modes - textToHtmlTokenizer', () => { tokenizeLineToHTML(text, lineTokens, colorMap, 0, 17, 4), [ '
', - '  ', + '  ', 'Ciao', - '   ', + '   ', 'hello', - ' ', + ' ', 'wo', '
' ].join('') @@ -269,7 +269,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => { tokenizeLineToHTML(text, lineTokens, colorMap, 0, 3, 4), [ '
', - '  ', + '  ', 'C', '
' ].join('') diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 9c69908c4d..8e1bace5eb 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -2494,6 +2494,11 @@ declare namespace monaco.editor { */ export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never'; + /** + * Configuration options for typing over closing quotes or brackets + */ + export type EditorAutoClosingOvertypeStrategy = 'always' | 'auto' | 'never'; + /** * Configuration options for editor minimap */ @@ -2922,6 +2927,10 @@ declare namespace monaco.editor { * Defaults to language defined behavior. */ autoClosingQuotes?: EditorAutoClosingStrategy; + /** + * Options for typing over closing quotes or brackets. + */ + autoClosingOvertype?: EditorAutoClosingOvertypeStrategy; /** * Options for auto surrounding. * Defaults to always allowing auto surrounding. @@ -3389,6 +3398,7 @@ declare namespace monaco.editor { readonly wordSeparators: string; readonly autoClosingBrackets: EditorAutoClosingStrategy; readonly autoClosingQuotes: EditorAutoClosingStrategy; + readonly autoClosingOvertype: EditorAutoClosingOvertypeStrategy; readonly autoSurround: EditorAutoSurroundStrategy; readonly autoIndent: boolean; readonly useTabStops: boolean; @@ -3530,6 +3540,7 @@ declare namespace monaco.editor { readonly wordSeparators: boolean; readonly autoClosingBrackets: boolean; readonly autoClosingQuotes: boolean; + readonly autoClosingOvertype: boolean; readonly autoSurround: boolean; readonly autoIndent: boolean; readonly useTabStops: boolean; diff --git a/src/vs/platform/dialogs/browser/dialogService.ts b/src/vs/platform/dialogs/browser/dialogService.ts index 2763fc059f..92928d95e0 100644 --- a/src/vs/platform/dialogs/browser/dialogService.ts +++ b/src/vs/platform/dialogs/browser/dialogService.ts @@ -14,14 +14,18 @@ import { attachDialogStyler } from 'vs/platform/theme/common/styler'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { EventHelper } from 'vs/base/browser/dom'; +import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; export class DialogService implements IDialogService { _serviceBrand: any; + private allowableCommands = ['copy', 'cut']; + constructor( @ILogService private readonly logService: ILogService, @ILayoutService private readonly layoutService: ILayoutService, - @IThemeService private readonly themeService: IThemeService + @IThemeService private readonly themeService: IThemeService, + @IKeybindingService private readonly keybindingService: IKeybindingService ) { } async confirm(confirmation: IConfirmation): Promise { @@ -50,7 +54,12 @@ export class DialogService implements IDialogService { cancelId: 1, type: confirmation.type, keyEventProcessor: (event: StandardKeyboardEvent) => { - EventHelper.stop(event, true); + const resolved = this.keybindingService.softDispatch(event, this.layoutService.container); + if (resolved && resolved.commandId) { + if (this.allowableCommands.indexOf(resolved.commandId) === -1) { + EventHelper.stop(event, true); + } + } }, checkboxChecked: confirmation.checkbox ? confirmation.checkbox.checked : undefined, checkboxLabel: confirmation.checkbox ? confirmation.checkbox.label : undefined @@ -82,7 +91,12 @@ export class DialogService implements IDialogService { cancelId: options ? options.cancelId : undefined, type: this.getDialogType(severity), keyEventProcessor: (event: StandardKeyboardEvent) => { - EventHelper.stop(event, true); + const resolved = this.keybindingService.softDispatch(event, this.layoutService.container); + if (resolved && resolved.commandId) { + if (this.allowableCommands.indexOf(resolved.commandId) === -1) { + EventHelper.stop(event, true); + } + } } }); diff --git a/src/vs/platform/editor/common/editor.ts b/src/vs/platform/editor/common/editor.ts index f3785d10a6..71712396d3 100644 --- a/src/vs/platform/editor/common/editor.ts +++ b/src/vs/platform/editor/common/editor.ts @@ -79,14 +79,41 @@ export interface IResourceInput extends IBaseResourceInput { readonly mode?: string; } +export enum EditorActivation { + + /** + * Activate the editor after it opened. + */ + ACTIVATE, + + /** + * Preserve the current active editor. + * + * Note: will only work in combination with the + * `preserveFocus: true` option. + */ + PRESERVE +} + export interface IEditorOptions { /** - * Tells the editor to not receive keyboard focus when the editor is being opened. By default, - * the editor will receive keyboard focus on open. + * Tells the editor to not receive keyboard focus when the editor is being opened. + * + * Will also not activate the group the editor opens in unless the group is already + * the active one. This behaviour can be overridden via the `activation` option. */ readonly preserveFocus?: boolean; + /** + * This option is only relevant if an editor is opened into a group that is not active + * already and allows to control if the inactive group should become active or not. + * + * By default, the editor group will become active unless `preserveFocus` or `inactive` + * is specified. + */ + readonly activation?: EditorActivation; + /** * Tells the editor to reload the editor input in the editor even if it is identical to the one * already showing. By default, the editor will not reload the input if it is identical to the @@ -123,7 +150,10 @@ export interface IEditorOptions { /** * An active editor that is opened will show its contents directly. Set to true to open an editor - * in the background. + * in the background without loading its contents. + * + * Will also not activate the group the editor opens in unless the group is already + * the active one. This behaviour can be overridden via the `activation` option. */ readonly inactive?: boolean; diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts index 29c5ead3f4..177ebea906 100644 --- a/src/vs/platform/environment/common/environment.ts +++ b/src/vs/platform/environment/common/environment.ts @@ -148,24 +148,15 @@ export interface IEnvironmentService { extensionTestsLocationURI?: URI; debugExtensionHost: IExtensionHostDebugParams; - debugSearch: IDebugParams; - - logExtensionHostCommunication: boolean; isBuilt: boolean; wait: boolean; status: boolean; - // logging log?: string; logsPath: string; verbose: boolean; - skipGettingStarted: boolean | undefined; - skipReleaseNotes: boolean | undefined; - - skipAddToRecentlyOpened: boolean; - mainIPCHandle: string; sharedIPCHandle: string; @@ -178,9 +169,5 @@ export interface IEnvironmentService { driverHandle?: string; driverVerbose: boolean; - webviewEndpoint?: string; - readonly webviewResourceRoot: string; - readonly webviewCspSource: string; - - readonly galleryMachineIdResource?: URI; + galleryMachineIdResource?: URI; } diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts index 9421af4537..d909752fe5 100644 --- a/src/vs/platform/environment/node/environmentService.ts +++ b/src/vs/platform/environment/node/environmentService.ts @@ -236,26 +236,15 @@ export class EnvironmentService implements IEnvironmentService { return false; } - get skipGettingStarted(): boolean { return !!this._args['skip-getting-started']; } - - get skipReleaseNotes(): boolean { return !!this._args['skip-release-notes']; } - - get skipAddToRecentlyOpened(): boolean { return !!this._args['skip-add-to-recently-opened']; } - @memoize get debugExtensionHost(): IExtensionHostDebugParams { return parseExtensionHostPort(this._args, this.isBuilt); } - @memoize - get debugSearch(): IDebugParams { return parseSearchPort(this._args, this.isBuilt); } - get isBuilt(): boolean { return !process.env['VSCODE_DEV']; } get verbose(): boolean { return !!this._args.verbose; } get log(): string | undefined { return this._args.log; } get wait(): boolean { return !!this._args.wait; } - get logExtensionHostCommunication(): boolean { return !!this._args.logExtensionHostCommunication; } - get status(): boolean { return !!this._args.status; } @memoize @@ -276,9 +265,6 @@ export class EnvironmentService implements IEnvironmentService { get driverHandle(): string | undefined { return this._args['driver']; } get driverVerbose(): boolean { return !!this._args['driver-verbose']; } - readonly webviewResourceRoot = 'vscode-resource:{{resource}}'; - readonly webviewCspSource = 'vscode-resource:'; - constructor(private _args: ParsedArgs, private _execPath: string) { if (!process.env['VSCODE_LOGS']) { const key = toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, ''); diff --git a/src/vs/platform/extensionManagement/common/extensionGalleryService.ts b/src/vs/platform/extensionManagement/common/extensionGalleryService.ts index fa0cc37363..1be4791613 100644 --- a/src/vs/platform/extensionManagement/common/extensionGalleryService.ts +++ b/src/vs/platform/extensionManagement/common/extensionGalleryService.ts @@ -9,7 +9,8 @@ import { getGalleryExtensionId, getGalleryExtensionTelemetryData, adoptToGallery import { assign, getOrDefault } from 'vs/base/common/objects'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IPager } from 'vs/base/common/paging'; -import { IRequestService, IRequestOptions, IRequestContext, asJson, asText, IHeaders } from 'vs/platform/request/common/request'; +import { IRequestService, asJson, asText } from 'vs/platform/request/common/request'; +import { IRequestOptions, IRequestContext, IHeaders } from 'vs/base/parts/request/common/request'; import { isEngineValid } from 'vs/platform/extensions/common/extensionValidator'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { generateUuid, isUUID } from 'vs/base/common/uuid'; diff --git a/src/vs/platform/request/browser/requestService.ts b/src/vs/platform/request/browser/requestService.ts index beb4134045..5b065d6dd5 100644 --- a/src/vs/platform/request/browser/requestService.ts +++ b/src/vs/platform/request/browser/requestService.ts @@ -3,13 +3,11 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IRequestOptions, IRequestContext } from 'vs/platform/request/common/request'; +import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request'; import { CancellationToken } from 'vs/base/common/cancellation'; -import { canceled } from 'vs/base/common/errors'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ILogService } from 'vs/platform/log/common/log'; -import { assign } from 'vs/base/common/objects'; -import { VSBuffer, bufferToStream } from 'vs/base/common/buffer'; +import { request } from 'vs/base/parts/request/browser/request'; /** * This service exposes the `request` API, while using the global @@ -28,69 +26,10 @@ export class RequestService { request(options: IRequestOptions, token: CancellationToken): Promise { this.logService.trace('RequestService#request', options.url); - const authorization = this.configurationService.getValue('http.proxyAuthorization'); - if (authorization) { - options.headers = assign(options.headers || {}, { 'Proxy-Authorization': authorization }); + if (!options.proxyAuthorization) { + options.proxyAuthorization = this.configurationService.getValue('http.proxyAuthorization'); } - const xhr = new XMLHttpRequest(); - return new Promise((resolve, reject) => { - - xhr.open(options.type || 'GET', options.url || '', true, options.user, options.password); - this.setRequestHeaders(xhr, options); - - xhr.responseType = 'arraybuffer'; - xhr.onerror = e => reject(new Error(xhr.statusText && ('XHR failed: ' + xhr.statusText))); - xhr.onload = (e) => { - resolve({ - res: { - statusCode: xhr.status, - headers: this.getResponseHeaders(xhr) - }, - stream: bufferToStream(VSBuffer.wrap(new Uint8Array(xhr.response))) - }); - }; - xhr.ontimeout = e => reject(new Error(`XHR timeout: ${options.timeout}ms`)); - - if (options.timeout) { - xhr.timeout = options.timeout; - } - - xhr.send(options.data); - - // cancel - token.onCancellationRequested(() => { - xhr.abort(); - reject(canceled()); - }); - }); + return request(options, token); } - - private setRequestHeaders(xhr: XMLHttpRequest, options: IRequestOptions): void { - if (options.headers) { - outer: for (let k in options.headers) { - switch (k) { - case 'User-Agent': - case 'Accept-Encoding': - case 'Content-Length': - // unsafe headers - continue outer; - } - xhr.setRequestHeader(k, options.headers[k]); - - } - } - } - - private getResponseHeaders(xhr: XMLHttpRequest): { [name: string]: string } { - const headers: { [name: string]: string } = Object.create(null); - for (const line of xhr.getAllResponseHeaders().split(/\r\n|\n|\r/g)) { - if (line) { - const idx = line.indexOf(':'); - headers[line.substr(0, idx).trim().toLowerCase()] = line.substr(idx + 1).trim(); - } - } - return headers; - } - -} \ No newline at end of file +} diff --git a/src/vs/platform/request/common/request.ts b/src/vs/platform/request/common/request.ts index 75c7a2cd05..be91292939 100644 --- a/src/vs/platform/request/common/request.ts +++ b/src/vs/platform/request/common/request.ts @@ -8,33 +8,11 @@ import { CancellationToken } from 'vs/base/common/cancellation'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IConfigurationRegistry, Extensions } from 'vs/platform/configuration/common/configurationRegistry'; import { Registry } from 'vs/platform/registry/common/platform'; -import { VSBufferReadableStream, streamToBuffer } from 'vs/base/common/buffer'; +import { streamToBuffer } from 'vs/base/common/buffer'; +import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request'; export const IRequestService = createDecorator('requestService'); -export interface IHeaders { - [header: string]: string; -} - -export interface IRequestOptions { - type?: string; - url?: string; - user?: string; - password?: string; - headers?: IHeaders; - timeout?: number; - data?: string; - followRedirects?: number; -} - -export interface IRequestContext { - res: { - headers: IHeaders; - statusCode?: number; - }; - stream: VSBufferReadableStream; -} - export interface IRequestService { _serviceBrand: any; diff --git a/src/vs/platform/request/common/requestIpc.ts b/src/vs/platform/request/common/requestIpc.ts index 5844832f27..1423b1ee57 100644 --- a/src/vs/platform/request/common/requestIpc.ts +++ b/src/vs/platform/request/common/requestIpc.ts @@ -5,7 +5,8 @@ import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc'; import { Event } from 'vs/base/common/event'; -import { IRequestService, IRequestOptions, IRequestContext, IHeaders } from 'vs/platform/request/common/request'; +import { IRequestService } from 'vs/platform/request/common/request'; +import { IRequestOptions, IRequestContext, IHeaders } from 'vs/base/parts/request/common/request'; import { CancellationToken } from 'vs/base/common/cancellation'; import { VSBuffer, bufferToStream, streamToBuffer } from 'vs/base/common/buffer'; diff --git a/src/vs/platform/request/electron-main/requestService.ts b/src/vs/platform/request/electron-main/requestService.ts index f7d1c3c836..efc7819c11 100644 --- a/src/vs/platform/request/electron-main/requestService.ts +++ b/src/vs/platform/request/electron-main/requestService.ts @@ -3,7 +3,7 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IRequestOptions, IRequestContext } from 'vs/platform/request/common/request'; +import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request'; import { RequestService as NodeRequestService, IRawRequestFunction } from 'vs/platform/request/node/requestService'; import { assign } from 'vs/base/common/objects'; import { net } from 'electron'; diff --git a/src/vs/platform/request/node/requestService.ts b/src/vs/platform/request/node/requestService.ts index 84bb704151..53b3a372ca 100644 --- a/src/vs/platform/request/node/requestService.ts +++ b/src/vs/platform/request/node/requestService.ts @@ -13,7 +13,8 @@ import { assign } from 'vs/base/common/objects'; import { isBoolean, isNumber } from 'vs/base/common/types'; import { canceled } from 'vs/base/common/errors'; import { CancellationToken } from 'vs/base/common/cancellation'; -import { IRequestOptions, IRequestContext, IRequestService, IHTTPConfiguration } from 'vs/platform/request/common/request'; +import { IRequestService, IHTTPConfiguration } from 'vs/platform/request/common/request'; +import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request'; import { getProxyAgent, Agent } from 'vs/platform/request/node/proxy'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ILogService } from 'vs/platform/log/common/log'; diff --git a/src/vs/workbench/api/browser/mainThreadWebview.ts b/src/vs/workbench/api/browser/mainThreadWebview.ts index 93a76472a6..6c20da49c3 100644 --- a/src/vs/workbench/api/browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/browser/mainThreadWebview.ts @@ -5,6 +5,7 @@ import { onUnexpectedError } from 'vs/base/common/errors'; import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; +import { isWeb } from 'vs/base/common/platform'; import { startsWith } from 'vs/base/common/strings'; import { URI, UriComponents } from 'vs/base/common/uri'; import * as modes from 'vs/editor/common/modes'; @@ -314,7 +315,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews if (MainThreadWebviews.standardSupportedLinkSchemes.has(link.scheme)) { return true; } - if (this._productService.urlProtocol === link.scheme) { + if (!isWeb && this._productService.urlProtocol === link.scheme) { return true; } return !!webview.webview.contentOptions.enableCommandUris && link.scheme === 'command'; diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index b40b454c74..85264a443e 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -1239,7 +1239,8 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi const editorNode: ISerializedLeafNode = { type: 'leaf', data: { type: Parts.EDITOR_PART }, - size: this.state.panel.position === Position.BOTTOM ? middleSectionHeight - (this.state.panel.hidden ? 0 : panelSize) : editorSectionWidth - (this.state.panel.hidden ? 0 : panelSize) + size: this.state.panel.position === Position.BOTTOM ? middleSectionHeight - (this.state.panel.hidden ? 0 : panelSize) : editorSectionWidth - (this.state.panel.hidden ? 0 : panelSize), + visible: true }; const panelNode: ISerializedLeafNode = { diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts index 67df837b2b..b1ed55e7e0 100644 --- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts +++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts @@ -447,7 +447,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCo MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_RIGHT, title: nls.localize('splitRight', "Split Right") }, group: '5_split', order: 40 }); // Editor Title Menu -MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.TOGGLE_DIFF_SIDE_BY_SIDE, title: nls.localize('toggleSideBySideView', "Toggle Side By Side View") }, group: '1_diff', order: 10, when: ContextKeyExpr.has('isInDiffEditor') }); +MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.TOGGLE_DIFF_SIDE_BY_SIDE, title: nls.localize('toggleInlineView', "Toggle Inline View") }, group: '1_diff', order: 10, when: ContextKeyExpr.has('isInDiffEditor') }); MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.SHOW_EDITORS_IN_GROUP, title: nls.localize('showOpenedEditors', "Show Opened Editors") }, group: '3_open', order: 10, when: ContextKeyExpr.has('config.workbench.editor.showTabs') }); MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: nls.localize('closeAll', "Close All") }, group: '5_close', order: 10, when: ContextKeyExpr.has('config.workbench.editor.showTabs') }); MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.CLOSE_SAVED_EDITORS_COMMAND_ID, title: nls.localize('closeAllSaved', "Close Saved") }, group: '5_close', order: 20, when: ContextKeyExpr.has('config.workbench.editor.showTabs') }); diff --git a/src/vs/workbench/browser/parts/editor/editor.ts b/src/vs/workbench/browser/parts/editor/editor.ts index 9babf58813..6db48da459 100644 --- a/src/vs/workbench/browser/parts/editor/editor.ts +++ b/src/vs/workbench/browser/parts/editor/editor.ts @@ -94,6 +94,7 @@ export interface IEditorGroupsAccessor { getGroups(order: GroupsOrder): IEditorGroupView[]; activateGroup(identifier: IEditorGroupView | GroupIdentifier): IEditorGroupView; + restoreGroup(identifier: IEditorGroupView | GroupIdentifier): IEditorGroupView; addGroup(location: IEditorGroupView | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): IEditorGroupView; mergeGroup(group: IEditorGroupView | GroupIdentifier, target: IEditorGroupView | GroupIdentifier, options?: IMergeGroupOptions): IEditorGroupView; diff --git a/src/vs/workbench/browser/parts/editor/editorActions.ts b/src/vs/workbench/browser/parts/editor/editorActions.ts index 043f6a062b..a871f54679 100644 --- a/src/vs/workbench/browser/parts/editor/editorActions.ts +++ b/src/vs/workbench/browser/parts/editor/editorActions.ts @@ -618,12 +618,24 @@ export abstract class BaseCloseAllAction extends Action { async run(): Promise { - // Just close all if there are no or one dirty editor - if (this.textFileService.getDirty().length < 2) { + // Just close all if there are no dirty editors + if (!this.textFileService.isDirty()) { return this.doCloseAll(); } - // Otherwise ask for combined confirmation + // Otherwise ask for combined confirmation and make sure + // to bring each dirty editor to the front so that the user + // can review if the files should be changed or not. + await Promise.all(this.groupsToClose.map(async groupToClose => { + for (const editor of groupToClose.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE)) { + if (editor.isDirty()) { + return groupToClose.openEditor(editor); + } + } + + return undefined; + })); + const confirm = await this.textFileService.confirmSave(); if (confirm === ConfirmResult.CANCEL) { return; diff --git a/src/vs/workbench/browser/parts/editor/editorControl.ts b/src/vs/workbench/browser/parts/editor/editorControl.ts index 21ec7001e9..0a28973189 100644 --- a/src/vs/workbench/browser/parts/editor/editorControl.ts +++ b/src/vs/workbench/browser/parts/editor/editorControl.ts @@ -112,7 +112,7 @@ export class EditorControl extends Disposable { if (!control.getContainer()) { const controlInstanceContainer = document.createElement('div'); addClass(controlInstanceContainer, 'editor-instance'); - controlInstanceContainer.id = descriptor.getId(); + controlInstanceContainer.setAttribute('data-editor-id', descriptor.getId()); control.create(controlInstanceContainer); } diff --git a/src/vs/workbench/browser/parts/editor/editorGroupView.ts b/src/vs/workbench/browser/parts/editor/editorGroupView.ts index 41777fafa2..97441b6945 100644 --- a/src/vs/workbench/browser/parts/editor/editorGroupView.ts +++ b/src/vs/workbench/browser/parts/editor/editorGroupView.ts @@ -53,6 +53,7 @@ import { hash } from 'vs/base/common/hash'; import { guessMimeTypes } from 'vs/base/common/mime'; import { extname } from 'vs/base/common/resources'; import { Schemas } from 'vs/base/common/network'; +import { EditorActivation } from 'vs/platform/editor/common/editor'; export class EditorGroupView extends Themable implements IEditorGroupView { @@ -489,7 +490,6 @@ export class EditorGroupView extends Themable implements IEditorGroupView { private onDidEditorOpen(editor: EditorInput): void { - // Telemetry /* __GDPR__ "editorOpened" : { "${include}": [ @@ -528,14 +528,13 @@ export class EditorGroupView extends Themable implements IEditorGroupView { } }); - // Telemetry /* __GDPR__ - "editorClosed" : { - "${include}": [ - "${EditorTelemetryDescriptor}" - ] - } - */ + "editorClosed" : { + "${include}": [ + "${EditorTelemetryDescriptor}" + ] + } + */ this.telemetryService.publicLog('editorClosed', this.toEditorTelemetryDescriptor(event.editor)); // Update container @@ -841,12 +840,31 @@ export class EditorGroupView extends Themable implements IEditorGroupView { openEditorOptions.active = true; } - // Set group active unless we open inactive or preserve focus + let activateGroup = false; + let restoreGroup = false; + + if (options && options.activation === EditorActivation.ACTIVATE) { + // Respect option to force activate an editor group. + activateGroup = true; + } else if (options && options.activation === EditorActivation.PRESERVE) { + // Respect option to preserve active editor group. + activateGroup = false; + } else if (openEditorOptions.active) { + // Finally, we only activate/restore an editor which is + // opening as active editor. + // If preserveFocus is enabled, we only restore but never + // activate the group. + activateGroup = !options || !options.preserveFocus; + restoreGroup = !activateGroup; + } + // Do this before we open the editor in the group to prevent a false // active editor change event before the editor is loaded // (see https://github.com/Microsoft/vscode/issues/51679) - if (openEditorOptions.active && (!options || !options.preserveFocus)) { + if (activateGroup) { this.accessor.activateGroup(this); + } else if (restoreGroup) { + this.accessor.restoreGroup(this); } // Actually move the editor if a specific index is provided and we figure diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index 885b2e6a80..f2725eb1eb 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -325,6 +325,13 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro return groupView; } + restoreGroup(group: IEditorGroupView | GroupIdentifier): IEditorGroupView { + const groupView = this.assertGroupView(group); + this.doRestoreGroup(groupView); + + return groupView; + } + getSize(group: IEditorGroupView | GroupIdentifier): { width: number, height: number } { const groupView = this.assertGroupView(group); @@ -337,7 +344,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro this.gridWidget.resizeView(groupView, size); } - arrangeGroups(arrangement: GroupsArrangement): void { + arrangeGroups(arrangement: GroupsArrangement, target = this.activeGroup): void { if (this.count < 2) { return; // require at least 2 groups to show } @@ -351,10 +358,10 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro this.gridWidget.distributeViewSizes(); break; case GroupsArrangement.MINIMIZE_OTHERS: - this.gridWidget.maximizeViewSize(this.activeGroup); + this.gridWidget.maximizeViewSize(target); break; case GroupsArrangement.TOGGLE: - if (this.isGroupMaximized(this.activeGroup)) { + if (this.isGroupMaximized(target)) { this.arrangeGroups(GroupsArrangement.EVEN); } else { this.arrangeGroups(GroupsArrangement.MINIMIZE_OTHERS); @@ -576,17 +583,21 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro group.setActive(true); // Maximize the group if it is currently minimized - if (this.gridWidget) { - const viewSize = this.gridWidget.getViewSize(group); - if (viewSize.width === group.minimumWidth || viewSize.height === group.minimumHeight) { - this.arrangeGroups(GroupsArrangement.MINIMIZE_OTHERS); - } - } + this.doRestoreGroup(group); // Event this._onDidActiveGroupChange.fire(group); } + private doRestoreGroup(group: IEditorGroupView): void { + if (this.gridWidget) { + const viewSize = this.gridWidget.getViewSize(group); + if (viewSize.width === group.minimumWidth || viewSize.height === group.minimumHeight) { + this.arrangeGroups(GroupsArrangement.MINIMIZE_OTHERS, group); + } + } + } + private doUpdateMostRecentActive(group: IEditorGroupView, makeMostRecentlyActive?: boolean): void { const index = this.mostRecentActiveGroups.indexOf(group.id); diff --git a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts index 77ceb18371..ecc9b704d3 100644 --- a/src/vs/workbench/browser/parts/editor/textDiffEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textDiffEditor.ts @@ -31,6 +31,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic import { CancellationToken } from 'vs/base/common/cancellation'; import { EditorMemento } from 'vs/workbench/browser/parts/editor/baseEditor'; import { IWindowService } from 'vs/platform/windows/common/windows'; +import { EditorActivation } from 'vs/platform/editor/common/editor'; /** * The text editor that leverages the diff text editor for the editing experience. @@ -184,6 +185,12 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor { modifiedInput.setForceOpenAsBinary(); } + // Make sure to not steal away the currently active group + // because we are triggering another openEditor() call + // and do not control the initial intent that resulted + // in us now opening as binary. + options.overwrite({ activation: EditorActivation.PRESERVE }); + this.editorService.openEditor(binaryDiffInput, options, this.group); return true; diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts index 161525981e..db61d8f790 100644 --- a/src/vs/workbench/browser/web.main.ts +++ b/src/vs/workbench/browser/web.main.ts @@ -18,7 +18,7 @@ import { RemoteAgentService } from 'vs/workbench/services/remote/browser/remoteA import { RemoteAuthorityResolverService } from 'vs/platform/remote/browser/remoteAuthorityResolverService'; import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; -import { IFileService, IFileSystemProvider } from 'vs/platform/files/common/files'; +import { IFileService } from 'vs/platform/files/common/files'; import { FileService } from 'vs/platform/files/common/fileService'; import { Schemas } from 'vs/base/common/network'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; @@ -124,7 +124,7 @@ class CodeRendererMain extends Disposable { const logService = new BufferLogService(); serviceCollection.set(ILogService, logService); - const payload = await this.resolveWorkspaceInitializationPayload(); + const payload = this.resolveWorkspaceInitializationPayload(); // Environment const environmentService = new BrowserWorkbenchEnvironmentService({ workspaceId: payload.id, logsPath, ...this.configuration }); @@ -149,46 +149,7 @@ class CodeRendererMain extends Disposable { // Files const fileService = this._register(new FileService(logService)); serviceCollection.set(IFileService, fileService); - - // Logger - const indexedDBLogProvider = new IndexedDBLogProvider(logsPath.scheme); - (async () => { - try { - await indexedDBLogProvider.database; - - fileService.registerProvider(logsPath.scheme, indexedDBLogProvider); - } catch (error) { - (logService).info('Error while creating indexedDB log provider. Falling back to in-memory log provider.'); - (logService).error(error); - - fileService.registerProvider(logsPath.scheme, new InMemoryLogProvider(logsPath.scheme)); - } - - const consoleLogService = new ConsoleLogService(logService.getLevel()); - const fileLogService = new FileLogService('window', environmentService.logFile, logService.getLevel(), fileService); - logService.logger = new MultiplexLogService([consoleLogService, fileLogService]); - })(); - - // User Data Provider - let userDataProvider: IFileSystemProvider | undefined = this.configuration.userDataProvider; - const connection = remoteAgentService.getConnection(); - if (connection) { - const channel = connection.getChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME); - const remoteFileSystemProvider = this._register(new RemoteExtensionsFileSystemProvider(channel, remoteAgentService.getEnvironment())); - - fileService.registerProvider(Schemas.vscodeRemote, remoteFileSystemProvider); - - if (!userDataProvider) { - const remoteUserDataUri = this.getRemoteUserDataUri(); - if (remoteUserDataUri) { - userDataProvider = this._register(new FileUserDataProvider(remoteUserDataUri, joinPath(remoteUserDataUri, BACKUPS), remoteFileSystemProvider, environmentService)); - } - } - } - if (!userDataProvider) { - userDataProvider = this._register(new InMemoryUserDataProvider()); - } - fileService.registerProvider(Schemas.userData, userDataProvider); + this.registerFileSystemProviders(environmentService, fileService, remoteAgentService, logService, logsPath); // Long running services (workspace, config, storage) const services = await Promise.all([ @@ -215,15 +176,59 @@ class CodeRendererMain extends Disposable { return { serviceCollection, logService, storageService: services[1] }; } + private registerFileSystemProviders(environmentService: IWorkbenchEnvironmentService, fileService: IFileService, remoteAgentService: IRemoteAgentService, logService: BufferLogService, logsPath: URI): void { + + // Logger + const indexedDBLogProvider = new IndexedDBLogProvider(logsPath.scheme); + (async () => { + try { + await indexedDBLogProvider.database; + + fileService.registerProvider(logsPath.scheme, indexedDBLogProvider); + } catch (error) { + (logService).info('Error while creating indexedDB log provider. Falling back to in-memory log provider.'); + (logService).error(error); + + fileService.registerProvider(logsPath.scheme, new InMemoryLogProvider(logsPath.scheme)); + } + + const consoleLogService = new ConsoleLogService(logService.getLevel()); + const fileLogService = new FileLogService('window', environmentService.logFile, logService.getLevel(), fileService); + logService.logger = new MultiplexLogService([consoleLogService, fileLogService]); + })(); + + const connection = remoteAgentService.getConnection(); + if (connection) { + + // Remote file system + const channel = connection.getChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME); + const remoteFileSystemProvider = this._register(new RemoteExtensionsFileSystemProvider(channel, remoteAgentService.getEnvironment())); + fileService.registerProvider(Schemas.vscodeRemote, remoteFileSystemProvider); + + if (!this.configuration.userDataProvider) { + const remoteUserDataUri = this.getRemoteUserDataUri(); + if (remoteUserDataUri) { + this.configuration.userDataProvider = this._register(new FileUserDataProvider(remoteUserDataUri, joinPath(remoteUserDataUri, BACKUPS), remoteFileSystemProvider, environmentService)); + } + } + } + + // User data + if (!this.configuration.userDataProvider) { + this.configuration.userDataProvider = this._register(new InMemoryUserDataProvider()); + } + fileService.registerProvider(Schemas.userData, this.configuration.userDataProvider); + } + private createProductService(): IProductService { - const element = document.getElementById('vscode-remote-product-configuration'); - const productConfiguration: IProductConfiguration = { - ...element ? JSON.parse(element.getAttribute('data-settings')!) : { + const productConfiguration = { + ...this.configuration.productConfiguration ? this.configuration.productConfiguration : { version: '1.38.0-unknown', nameLong: 'Unknown', extensionAllowedProposedApi: [], }, ...{ urlProtocol: '' } - }; + } as IProductConfiguration; + return { _serviceBrand: undefined, ...productConfiguration }; } @@ -280,6 +285,7 @@ class CodeRendererMain extends Disposable { return joinPath(URI.revive(JSON.parse(remoteUserDataPath)), 'User'); } } + return null; } } diff --git a/src/vs/workbench/browser/workbench.contribution.ts b/src/vs/workbench/browser/workbench.contribution.ts index 68492759aa..c31d189933 100644 --- a/src/vs/workbench/browser/workbench.contribution.ts +++ b/src/vs/workbench/browser/workbench.contribution.ts @@ -242,7 +242,7 @@ import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform' }, 'workbench.octiconsUpdate.enabled': { 'type': 'boolean', - 'default': true, + 'default': false, 'description': nls.localize('workbench.octiconsUpdate.enabled', "Controls the visibility of the new Octicons style in the workbench.") } } diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index 667cd3fede..a50d4605f1 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -9,7 +9,7 @@ import { isUndefinedOrNull } from 'vs/base/common/types'; import { URI } from 'vs/base/common/uri'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; import { IEditor as ICodeEditor, IEditorViewState, ScrollType, IDiffEditor } from 'vs/editor/common/editorCommon'; -import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput, IResourceInput } from 'vs/platform/editor/common/editor'; +import { IEditorModel, IEditorOptions, ITextEditorOptions, IBaseResourceInput, IResourceInput, EditorActivation } from 'vs/platform/editor/common/editor'; import { IInstantiationService, IConstructorSignature0, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -718,25 +718,28 @@ export class EditorOptions implements IEditorOptions { */ static create(settings: IEditorOptions): EditorOptions { const options = new EditorOptions(); - - options.preserveFocus = settings.preserveFocus; - options.forceReload = settings.forceReload; - options.revealIfVisible = settings.revealIfVisible; - options.revealIfOpened = settings.revealIfOpened; - options.pinned = settings.pinned; - options.index = settings.index; - options.inactive = settings.inactive; - options.ignoreError = settings.ignoreError; + options.overwrite(settings); return options; } /** - * Tells the editor to not receive keyboard focus when the editor is being opened. By default, - * the editor will receive keyboard focus on open. + * Tells the editor to not receive keyboard focus when the editor is being opened. + * + * Will also not activate the group the editor opens in unless the group is already + * the active one. This behaviour can be overridden via the `activation` option. */ preserveFocus: boolean | undefined; + /** + * This option is only relevant if an editor is opened into a group that is not active + * already and allows to control if the inactive group should become active or not. + * + * By default, the editor group will become active unless `preserveFocus` or `inactive` + * is specified. + */ + activation: EditorActivation | undefined; + /** * Tells the editor to reload the editor input in the editor even if it is identical to the one * already showing. By default, the editor will not reload the input if it is identical to the @@ -767,7 +770,10 @@ export class EditorOptions implements IEditorOptions { /** * An active editor that is opened will show its contents directly. Set to true to open an editor - * in the background. + * in the background without loading its contents. + * + * Will also not activate the group the editor opens in unless the group is already + * the active one. This behaviour can be overridden via the `activation` option. */ inactive: boolean | undefined; @@ -776,6 +782,49 @@ export class EditorOptions implements IEditorOptions { * message as needed. By default, an error will be presented as notification if opening was not possible. */ ignoreError: boolean | undefined; + + /** + * Overwrites option values from the provided bag. + */ + overwrite(options: IEditorOptions): EditorOptions { + if (typeof options.forceReload === 'boolean') { + this.forceReload = options.forceReload; + } + + if (typeof options.revealIfVisible === 'boolean') { + this.revealIfVisible = options.revealIfVisible; + } + + if (typeof options.revealIfOpened === 'boolean') { + this.revealIfOpened = options.revealIfOpened; + } + + if (typeof options.preserveFocus === 'boolean') { + this.preserveFocus = options.preserveFocus; + } + + if (typeof options.activation === 'number') { + this.activation = options.activation; + } + + if (typeof options.pinned === 'boolean') { + this.pinned = options.pinned; + } + + if (typeof options.inactive === 'boolean') { + this.inactive = options.inactive; + } + + if (typeof options.ignoreError === 'boolean') { + this.ignoreError = options.ignoreError; + } + + if (typeof options.index === 'number') { + this.index = options.index; + } + + return this; + } } /** @@ -803,53 +852,31 @@ export class TextEditorOptions extends EditorOptions { */ static create(options: ITextEditorOptions = Object.create(null)): TextEditorOptions { const textEditorOptions = new TextEditorOptions(); + textEditorOptions.overwrite(options); + + return textEditorOptions; + } + + /** + * Overwrites option values from the provided bag. + */ + overwrite(options: ITextEditorOptions): TextEditorOptions { + super.overwrite(options); if (options.selection) { const selection = options.selection; - textEditorOptions.selection(selection.startLineNumber, selection.startColumn, selection.endLineNumber, selection.endColumn); + this.selection(selection.startLineNumber, selection.startColumn, selection.endLineNumber, selection.endColumn); } if (options.viewState) { - textEditorOptions.editorViewState = options.viewState as IEditorViewState; + this.editorViewState = options.viewState as IEditorViewState; } - if (options.forceReload) { - textEditorOptions.forceReload = true; + if (typeof options.revealInCenterIfOutsideViewport === 'boolean') { + this.revealInCenterIfOutsideViewport = options.revealInCenterIfOutsideViewport; } - if (options.revealIfVisible) { - textEditorOptions.revealIfVisible = true; - } - - if (options.revealIfOpened) { - textEditorOptions.revealIfOpened = true; - } - - if (options.preserveFocus) { - textEditorOptions.preserveFocus = true; - } - - if (options.revealInCenterIfOutsideViewport) { - textEditorOptions.revealInCenterIfOutsideViewport = true; - } - - if (options.pinned) { - textEditorOptions.pinned = true; - } - - if (options.inactive) { - textEditorOptions.inactive = true; - } - - if (options.ignoreError) { - textEditorOptions.ignoreError = true; - } - - if (typeof options.index === 'number') { - textEditorOptions.index = options.index; - } - - return textEditorOptions; + return this; } /** diff --git a/src/vs/workbench/contrib/debug/browser/repl.ts b/src/vs/workbench/contrib/debug/browser/repl.ts index 60613a2a50..d091e18538 100644 --- a/src/vs/workbench/contrib/debug/browser/repl.ts +++ b/src/vs/workbench/contrib/debug/browser/repl.ts @@ -768,7 +768,7 @@ class ReplDelegate implements IListVirtualDelegate { return (nameRows + 1) * rowHeight; } - let valueRows = countNumberOfLines(value) + Math.floor(value.length / 150); + let valueRows = value ? (countNumberOfLines(value) + Math.floor(value.length / 150)) : 0; return rowHeight * (nameRows + valueRows); } diff --git a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts index 5bc92050f4..972a3efe9d 100644 --- a/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts +++ b/src/vs/workbench/contrib/files/browser/editors/fileEditorTracker.ts @@ -27,6 +27,7 @@ import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/editor import { ResourceQueue, timeout } from 'vs/base/common/async'; import { onUnexpectedError } from 'vs/base/common/errors'; import { withNullAsUndefined } from 'vs/base/common/types'; +import { EditorActivation } from 'vs/platform/editor/common/editor'; // {{SQL CARBON EDIT}} import { QueryInput } from 'sql/workbench/parts/query/common/queryInput'; @@ -334,7 +335,7 @@ export class FileEditorTracker extends Disposable implements IWorkbenchContribut // Binary editor that should reload from event if (resource && editor.input && isBinaryEditor && (e.contains(resource, FileChangeType.UPDATED) || e.contains(resource, FileChangeType.ADDED))) { - this.editorService.openEditor(editor.input, { forceReload: true, preserveFocus: true }, editor.group); + this.editorService.openEditor(editor.input, { forceReload: true, preserveFocus: true, activation: EditorActivation.PRESERVE }, editor.group); } }); } diff --git a/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts b/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts index 743cd9a488..d18a8c2e3b 100644 --- a/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts +++ b/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts @@ -32,6 +32,7 @@ import { CancellationToken } from 'vs/base/common/cancellation'; import { IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor'; import { createErrorWithActions } from 'vs/base/common/errorsWithActions'; import { MutableDisposable } from 'vs/base/common/lifecycle'; +import { EditorActivation } from 'vs/platform/editor/common/editor'; /** * An implementation of editor for file system resources. @@ -225,6 +226,13 @@ export class TextFileEditor extends BaseTextEditor { private openAsBinary(input: FileEditorInput, options: EditorOptions): void { input.setForceOpenAsBinary(); + + // Make sure to not steal away the currently active group + // because we are triggering another openEditor() call + // and do not control the initial intent that resulted + // in us now opening as binary. + options.overwrite({ activation: EditorActivation.PRESERVE }); + this.editorService.openEditor(input, options, this.group); } diff --git a/src/vs/workbench/contrib/files/browser/explorerViewlet.ts b/src/vs/workbench/contrib/files/browser/explorerViewlet.ts index 4df07f409b..f1c38ef8b7 100644 --- a/src/vs/workbench/contrib/files/browser/explorerViewlet.ts +++ b/src/vs/workbench/contrib/files/browser/explorerViewlet.ts @@ -26,10 +26,9 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { DelegatingEditorService } from 'vs/workbench/services/editor/browser/editorService'; -import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; +import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { IEditorOptions } from 'vs/platform/editor/common/editor'; -import { IEditorInput, IEditor } from 'vs/workbench/common/editor'; +import { IEditor } from 'vs/workbench/common/editor'; import { ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet'; import { KeyChord, KeyMod, KeyCode } from 'vs/base/common/keyCodes'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -158,7 +157,6 @@ export class ExplorerViewlet extends ViewContainerViewlet { @ITelemetryService telemetryService: ITelemetryService, @IWorkspaceContextService protected contextService: IWorkspaceContextService, @IStorageService protected storageService: IStorageService, - @IEditorService private readonly editorService: IEditorService, @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService, @IConfigurationService configurationService: IConfigurationService, @IInstantiationService protected instantiationService: IInstantiationService, @@ -187,7 +185,7 @@ export class ExplorerViewlet extends ViewContainerViewlet { // We try to be smart and only use the delay if we recognize that the user action is likely to cause // a new entry in the opened editors view. const delegatingEditorService = this.instantiationService.createInstance(DelegatingEditorService); - delegatingEditorService.setEditorOpenHandler(async (group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions): Promise => { + delegatingEditorService.setEditorOpenHandler(async (delegate, group, editor, options): Promise => { let openEditorsView = this.getOpenEditorsView(); if (openEditorsView) { let delay = 0; @@ -205,7 +203,7 @@ export class ExplorerViewlet extends ViewContainerViewlet { let openedEditor: IEditor | undefined; try { - openedEditor = await this.editorService.openEditor(editor, options, group); + openedEditor = await delegate(group, editor, options); } catch (error) { // ignore } finally { diff --git a/src/vs/workbench/contrib/files/browser/fileCommands.ts b/src/vs/workbench/contrib/files/browser/fileCommands.ts index 43dae5fd81..d02903686e 100644 --- a/src/vs/workbench/contrib/files/browser/fileCommands.ts +++ b/src/vs/workbench/contrib/files/browser/fileCommands.ts @@ -244,23 +244,23 @@ async function saveAll(saveAllArguments: any, editorService: IEditorService, unt // Store some properties per untitled file to restore later after save is completed const groupIdToUntitledResourceInput = new Map(); - editorGroupService.groups.forEach(g => { - const activeEditorResource = g.activeEditor && g.activeEditor.getResource(); - g.editors.forEach(e => { + editorGroupService.groups.forEach(group => { + const activeEditorResource = group.activeEditor && group.activeEditor.getResource(); + group.editors.forEach(e => { const resource = e.getResource(); if (resource && untitledEditorService.isDirty(resource)) { - if (!groupIdToUntitledResourceInput.has(g.id)) { - groupIdToUntitledResourceInput.set(g.id, []); + if (!groupIdToUntitledResourceInput.has(group.id)) { + groupIdToUntitledResourceInput.set(group.id, []); } - groupIdToUntitledResourceInput.get(g.id)!.push({ + groupIdToUntitledResourceInput.get(group.id)!.push({ encoding: untitledEditorService.getEncoding(resource), resource, options: { inactive: activeEditorResource ? activeEditorResource.toString() !== resource.toString() : true, pinned: true, preserveFocus: true, - index: g.getIndexOfEditor(e) + index: group.getIndexOfEditor(e) } }); } diff --git a/src/vs/workbench/contrib/files/browser/views/explorerView.ts b/src/vs/workbench/contrib/files/browser/views/explorerView.ts index a14c80c605..7e9323aaa6 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerView.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerView.ts @@ -241,8 +241,7 @@ export class ExplorerView extends ViewletPanel { const activeFile = this.getActiveFile(); if (!activeFile && !focused[0].isDirectory) { // Open the focused element in the editor if there is currently no file opened #67708 - this.editorService.openEditor({ resource: focused[0].resource, options: { preserveFocus: true, revealIfVisible: true } }) - .then(undefined, onUnexpectedError); + this.editorService.openEditor({ resource: focused[0].resource, options: { preserveFocus: true, revealIfVisible: true } }); } } } diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index f8d5911316..79e8bfcb63 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -28,7 +28,7 @@ import { IListVirtualDelegate, IListRenderer, IListContextMenuEvent, IListDragAn import { ResourceLabels, IResourceLabel } from 'vs/workbench/browser/labels'; import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService'; +import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem'; import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions'; @@ -263,15 +263,21 @@ export class OpenEditorsView extends ViewletPanel { let openToSide = false; let isSingleClick = false; let isDoubleClick = false; + let isMiddleClick = false; if (browserEvent instanceof MouseEvent) { isSingleClick = browserEvent.detail === 1; isDoubleClick = browserEvent.detail === 2; + isMiddleClick = browserEvent.button === 1; openToSide = this.list.useAltAsMultipleSelectionModifier ? (browserEvent.ctrlKey || browserEvent.metaKey) : browserEvent.altKey; } const focused = this.list.getFocusedElements(); const element = focused.length ? focused[0] : undefined; if (element instanceof OpenEditor) { + if (isMiddleClick) { + return; // already handled above: closes the editor + } + this.openEditor(element, { preserveFocus: isSingleClick, pinned: isDoubleClick, sideBySide: openToSide }); } else if (element) { this.editorGroupService.activateGroup(element); @@ -349,13 +355,9 @@ export class OpenEditorsView extends ViewletPanel { const preserveActivateGroup = options.sideBySide && options.preserveFocus; // needed for https://github.com/Microsoft/vscode/issues/42399 if (!preserveActivateGroup) { - this.editorGroupService.activateGroup(element.groupId); // needed for https://github.com/Microsoft/vscode/issues/6672 + this.editorGroupService.activateGroup(element.group); // needed for https://github.com/Microsoft/vscode/issues/6672 } - this.editorService.openEditor(element.editor, options, options.sideBySide ? SIDE_GROUP : ACTIVE_GROUP).then(editor => { - if (editor && !preserveActivateGroup && editor.group) { - this.editorGroupService.activateGroup(editor.group); - } - }); + this.editorService.openEditor(element.editor, options, options.sideBySide ? SIDE_GROUP : element.group); } } diff --git a/src/vs/workbench/contrib/files/common/dirtyFilesTracker.ts b/src/vs/workbench/contrib/files/common/dirtyFilesTracker.ts index 98f4e3492a..5496e98224 100644 --- a/src/vs/workbench/contrib/files/common/dirtyFilesTracker.ts +++ b/src/vs/workbench/contrib/files/common/dirtyFilesTracker.ts @@ -15,7 +15,7 @@ import { URI } from 'vs/base/common/uri'; import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity'; import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService'; import * as arrays from 'vs/base/common/arrays'; -import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService'; +import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; export class DirtyFilesTracker extends Disposable implements IWorkbenchContribution { private isDocumentedEdited: boolean; @@ -88,7 +88,6 @@ export class DirtyFilesTracker extends Disposable implements IWorkbenchContribut } private doOpenDirtyResources(resources: URI[]): void { - const activeEditor = this.editorService.activeControl; // Open this.editorService.openEditors(resources.map(resource => { @@ -96,7 +95,7 @@ export class DirtyFilesTracker extends Disposable implements IWorkbenchContribut resource, options: { inactive: true, pinned: true, preserveFocus: true } }; - }), activeEditor ? activeEditor.group : ACTIVE_GROUP); + })); } private onTextFilesSaved(e: TextFileModelChangeEvent[]): void { diff --git a/src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts b/src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts index 6aac8f1822..bc55424f03 100644 --- a/src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts +++ b/src/vs/workbench/contrib/preferences/browser/keybindingsEditor.ts @@ -46,6 +46,7 @@ import { attachStylerCallback, attachInputBoxStyler } from 'vs/platform/theme/co import { IStorageService } from 'vs/platform/storage/common/storage'; import { InputBox, MessageType } from 'vs/base/browser/ui/inputbox/inputBox'; import { Emitter, Event } from 'vs/base/common/event'; +import { MenuRegistry, MenuId, isIMenuItem } from 'vs/platform/actions/common/actions'; const $ = DOM.$; @@ -489,11 +490,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor if (this.input) { const input: KeybindingsEditorInput = this.input as KeybindingsEditorInput; this.keybindingsEditorModel = await input.resolve(); - const editorActionsLabels: Map = EditorExtensionsRegistry.getEditorActions().reduce((editorActions, editorAction) => { - editorActions.set(editorAction.id, editorAction.label); - return editorActions; - }, new Map()); - await this.keybindingsEditorModel.resolve(editorActionsLabels); + await this.keybindingsEditorModel.resolve(this.getActionsLabels()); this.renderKeybindingsEntries(false, preserveFocus); if (input.searchOptions) { this.recordKeysAction.checked = input.searchOptions.recordKeybindings; @@ -505,6 +502,19 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor } } + private getActionsLabels(): Map { + const actionsLabels: Map = new Map(); + EditorExtensionsRegistry.getEditorActions().forEach(editorAction => actionsLabels.set(editorAction.id, editorAction.label)); + for (const menuItem of MenuRegistry.getMenuItems(MenuId.CommandPalette)) { + if (isIMenuItem(menuItem)) { + const title = typeof menuItem.command.title === 'string' ? menuItem.command.title : menuItem.command.title.value; + const category = menuItem.command.category ? typeof menuItem.command.category === 'string' ? menuItem.command.category : menuItem.command.category.value : undefined; + actionsLabels.set(menuItem.command.id, category ? `${category}: ${title}` : title); + } + } + return actionsLabels; + } + private filterKeybindings(): void { this.renderKeybindingsEntries(this.searchWidget.hasFocus()); this.delayedFilterLogging.trigger(() => this.reportFilteringUsed(this.searchWidget.getValue())); @@ -716,7 +726,7 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor private createCopyCommandAction(keybinding: IKeybindingItemEntry): IAction { return { - label: localize('copyCommandLabel', "Copy Command"), + label: localize('copyCommandLabel', "Copy Command ID"), enabled: true, id: KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND, run: () => this.copyKeybindingCommand(keybinding) diff --git a/src/vs/workbench/contrib/quickopen/browser/gotoLineHandler.ts b/src/vs/workbench/contrib/quickopen/browser/gotoLineHandler.ts index bb42c2073e..aa94d7d28a 100644 --- a/src/vs/workbench/contrib/quickopen/browser/gotoLineHandler.ts +++ b/src/vs/workbench/contrib/quickopen/browser/gotoLineHandler.ts @@ -87,8 +87,10 @@ class GotoLineEntry extends EditorQuickOpenEntry { private parseInput(line: string) { const numbers = line.split(/,|:|#/).map(part => parseInt(part, 10)).filter(part => !isNaN(part)); - this.line = numbers[0]; + const endLine = this.getMaxLineNumber() + 1; + this.column = numbers[1]; + this.line = numbers[0] > 0 ? numbers[0] : endLine + numbers[0]; } getLabel(): string { @@ -113,7 +115,7 @@ class GotoLineEntry extends EditorQuickOpenEntry { } private invalidRange(maxLineNumber: number = this.getMaxLineNumber()): boolean { - return !this.line || !types.isNumber(this.line) || (maxLineNumber > 0 && types.isNumber(this.line) && this.line > maxLineNumber); + return !this.line || !types.isNumber(this.line) || (maxLineNumber > 0 && types.isNumber(this.line) && this.line > maxLineNumber) || this.line < 0; } private getMaxLineNumber(): number { diff --git a/src/vs/workbench/contrib/quickopen/browser/gotoSymbolHandler.ts b/src/vs/workbench/contrib/quickopen/browser/gotoSymbolHandler.ts index f6d56d2702..16d112e4d7 100644 --- a/src/vs/workbench/contrib/quickopen/browser/gotoSymbolHandler.ts +++ b/src/vs/workbench/contrib/quickopen/browser/gotoSymbolHandler.ts @@ -17,7 +17,7 @@ import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen'; import { ITextEditorOptions } from 'vs/platform/editor/common/editor'; import { getDocumentSymbols } from 'vs/editor/contrib/quickOpen/quickOpen'; import { DocumentSymbolProviderRegistry, DocumentSymbol, symbolKindToCssClass, SymbolKind, SymbolTag } from 'vs/editor/common/modes'; -import { IRange } from 'vs/editor/common/core/range'; +import { IRange, Range } from 'vs/editor/common/core/range'; import { themeColorFromId } from 'vs/platform/theme/common/themeService'; import { overviewRulerRangeHighlight } from 'vs/editor/common/view/editorColorRegistry'; import { GroupIdentifier, IEditorInput } from 'vs/workbench/common/editor'; @@ -88,7 +88,7 @@ class OutlineModel extends QuickOpenModel { // Filter by search if (searchValue.length > searchValuePos) { const score = filters.fuzzyScore( - searchValue.substr(searchValuePos), searchValueLow.substr(searchValuePos), 0, + searchValue, searchValueLow, searchValuePos, entry.getLabel(), entry.getLabel().toLowerCase(), 0, true ); @@ -219,7 +219,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup { getOptions(pinned?: boolean): ITextEditorOptions { return { - selection: this.revealRange, + selection: Range.collapseToStart(this.revealRange), pinned }; } @@ -242,7 +242,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup { // Apply selection and focus else { - const range = this.revealRange; + const range = Range.collapseToStart(this.revealRange); const activeTextEditorWidget = this.editorService.activeTextEditorWidget; if (activeTextEditorWidget) { activeTextEditorWidget.setSelection(range); @@ -256,7 +256,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup { private runPreview(): boolean { // Select Outline Position - const range = this.revealRange; + const range = Range.collapseToStart(this.revealRange); const activeTextEditorWidget = this.editorService.activeTextEditorWidget; if (activeTextEditorWidget) { activeTextEditorWidget.revealRangeInCenter(range, ScrollType.Smooth); diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index 4fbf221d2c..bd28068065 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -52,7 +52,6 @@ import { IReplaceService } from 'vs/workbench/contrib/search/common/replace'; import { getOutOfWorkspaceEditorResources } from 'vs/workbench/contrib/search/common/search'; import { FileMatch, FileMatchOrMatch, FolderMatch, IChangeEvent, ISearchWorkbenchService, Match, RenderableMatch, searchMatchComparer, SearchModel, SearchResult, BaseFolderMatch } from 'vs/workbench/contrib/search/common/searchModel'; import { ACTIVE_GROUP, IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; -import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IPreferencesService, ISettingsEditorOptions } from 'vs/workbench/services/preferences/common/preferences'; import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService'; import { relativePath } from 'vs/base/common/resources'; @@ -148,7 +147,6 @@ export class SearchView extends ViewletPanel { @IPreferencesService private readonly preferencesService: IPreferencesService, @IThemeService protected themeService: IThemeService, @ISearchHistoryService private readonly searchHistoryService: ISearchHistoryService, - @IEditorGroupsService private readonly editorGroupsService: IEditorGroupsService, @IContextMenuService contextMenuService: IContextMenuService, @IMenuService private readonly menuService: IMenuService, @IAccessibilityService private readonly accessibilityService: IAccessibilityService, @@ -1570,10 +1568,6 @@ export class SearchView extends ViewletPanel { } else { this.viewModel.searchResult.rangeHighlightDecorations.removeHighlightRange(); } - - if (editor) { - this.editorGroupsService.activateGroup(editor.group!); - } }, errors.onUnexpectedError); } diff --git a/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts b/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts index 83f3d00b27..bbb9a408e8 100644 --- a/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts +++ b/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.ts @@ -98,7 +98,7 @@ const presentation: IJSONSchema = { showReuseMessage: true, clear: false, }, - description: nls.localize('JsonSchema.tasks.presentation', 'Configures the panel that is used to present the task\'s ouput and reads its input.'), + description: nls.localize('JsonSchema.tasks.presentation', 'Configures the panel that is used to present the task\'s output and reads its input.'), additionalProperties: false, properties: { echo: { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts b/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts index cea1df3ca6..f737123c7c 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts @@ -17,6 +17,10 @@ import { Emitter, Event } from 'vs/base/common/event'; import { basename } from 'vs/base/common/path'; import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement'; import { ExtensionType } from 'vs/platform/extensions/common/extensions'; +import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { InstallRecommendedExtensionAction } from 'vs/workbench/contrib/extensions/browser/extensionsActions'; +import { IProductService } from 'vs/platform/product/common/product'; const MINIMUM_FONT_SIZE = 6; const MAXIMUM_FONT_SIZE = 25; @@ -40,7 +44,10 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { @IConfigurationService private readonly _configurationService: IConfigurationService, @IExtensionManagementService private readonly _extensionManagementService: IExtensionManagementService, @INotificationService private readonly _notificationService: INotificationService, - @IStorageService private readonly _storageService: IStorageService + @IStorageService private readonly _storageService: IStorageService, + @ITelemetryService private readonly telemetryService: ITelemetryService, + @IInstantiationService private readonly instantiationService: IInstantiationService, + @IProductService private readonly productService: IProductService ) { this._updateConfig(); this._configurationService.onDidChangeConfiguration(e => { @@ -263,18 +270,42 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper { this.recommendationsShown = true; if (platform.isWindows && shellLaunchConfig.executable && basename(shellLaunchConfig.executable).toLowerCase() === 'wsl.exe') { - if (! await this.isExtensionInstalled('ms-vscode-remote.remote-wsl')) { + const exeBasedExtensionTips = this.productService.exeBasedExtensionTips; + if (!exeBasedExtensionTips || !exeBasedExtensionTips.wsl) { + return; + } + const extId = exeBasedExtensionTips.wsl.recommendations[0]; + if (extId && ! await this.isExtensionInstalled(extId)) { this._notificationService.prompt( Severity.Info, nls.localize( - 'useWslExtension.title', - "Check out the 'Visual Studio Code Remote - WSL' extension for a great development experience in WSL. Click [here]({0}) to learn more.", - 'https://go.microsoft.com/fwlink/?linkid=2097212' - ), - [], + 'useWslExtension.title', "The '{0}' extension is recommended for opening a terminal in WSL.", exeBasedExtensionTips.wsl.friendlyName), + [ + { + label: nls.localize('install', 'Install'), + run: () => { + /* __GDPR__ + "terminalLaunchRecommendation:popup" : { + "userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, + "extensionId": { "classification": "PublicNonPersonalData", "purpose": "FeatureInsight" } + } + */ + this.telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'install', extId }); + this.instantiationService.createInstance(InstallRecommendedExtensionAction, extId).run(); + } + } + ], { sticky: true, - neverShowAgain: { id: 'terminalConfigHelper/launchRecommendationsIgnore', scope: NeverShowAgainScope.WORKSPACE } + neverShowAgain: { id: 'terminalConfigHelper/launchRecommendationsIgnore', scope: NeverShowAgainScope.WORKSPACE }, + onCancel: () => { + /* __GDPR__ + "terminalLaunchRecommendation:popup" : { + "userReaction" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + } + */ + this.telemetryService.publicLog('terminalLaunchRecommendation:popup', { userReaction: 'cancelled' }); + } } ); } diff --git a/src/vs/workbench/contrib/terminal/test/electron-browser/terminalConfigHelper.test.ts b/src/vs/workbench/contrib/terminal/test/electron-browser/terminalConfigHelper.test.ts index 5d9b71d498..6c743f2736 100644 --- a/src/vs/workbench/contrib/terminal/test/electron-browser/terminalConfigHelper.test.ts +++ b/src/vs/workbench/contrib/terminal/test/electron-browser/terminalConfigHelper.test.ts @@ -29,7 +29,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk const configurationService = new TestConfigurationService(); configurationService.setUserConfiguration('editor', { fontFamily: 'foo' }); configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: null } }); - const configHelper = new TerminalConfigHelper(LinuxDistro.Fedora, configurationService, null!, null!, null!); + const configHelper = new TerminalConfigHelper(LinuxDistro.Fedora, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontFamily, '\'DejaVu Sans Mono\', monospace', 'Fedora should have its font overridden when terminal.integrated.fontFamily not set'); }); @@ -38,7 +38,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk const configurationService = new TestConfigurationService(); configurationService.setUserConfiguration('editor', { fontFamily: 'foo' }); configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: null } }); - const configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!); + const configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontFamily, '\'Ubuntu Mono\', monospace', 'Ubuntu should have its font overridden when terminal.integrated.fontFamily not set'); }); @@ -47,7 +47,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk const configurationService = new TestConfigurationService(); configurationService.setUserConfiguration('editor', { fontFamily: 'foo' }); configurationService.setUserConfiguration('terminal', { integrated: { fontFamily: null } }); - const configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + const configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontFamily, 'foo', 'editor.fontFamily should be the fallback when terminal.integrated.fontFamily not set'); }); @@ -65,7 +65,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk fontSize: 10 } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontSize, 10, 'terminal.integrated.fontSize should be selected over editor.fontSize'); @@ -78,11 +78,11 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk fontSize: 0 } }); - configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!); + configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontSize, 8, 'The minimum terminal font size (with adjustment) should be used when terminal.integrated.fontSize less than it'); - configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontSize, 6, 'The minimum terminal font size should be used when terminal.integrated.fontSize less than it'); @@ -95,7 +95,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk fontSize: 1500 } }); - configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontSize, 25, 'The maximum terminal font size should be used when terminal.integrated.fontSize more than it'); @@ -108,11 +108,11 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk fontSize: null } }); - configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!); + configHelper = new TerminalConfigHelper(LinuxDistro.Ubuntu, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontSize, EDITOR_FONT_DEFAULTS.fontSize + 2, 'The default editor font size (with adjustment) should be used when terminal.integrated.fontSize is not set'); - configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().fontSize, EDITOR_FONT_DEFAULTS.fontSize, 'The default editor font size should be used when terminal.integrated.fontSize is not set'); }); @@ -130,7 +130,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk lineHeight: 2 } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().lineHeight, 2, 'terminal.integrated.lineHeight should be selected over editor.lineHeight'); @@ -144,7 +144,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk lineHeight: 0 } }); - configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.getFont().lineHeight, 1, 'editor.lineHeight should be 1 when terminal.integrated.lineHeight not set'); }); @@ -157,7 +157,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.configFontIsMonospace(), true, 'monospace is monospaced'); }); @@ -169,7 +169,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk fontFamily: 'sans-serif' } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.configFontIsMonospace(), false, 'sans-serif is not monospaced'); }); @@ -181,7 +181,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk fontFamily: 'serif' } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.configFontIsMonospace(), false, 'serif is not monospaced'); }); @@ -197,7 +197,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.configFontIsMonospace(), true, 'monospace is monospaced'); }); @@ -213,7 +213,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.configFontIsMonospace(), false, 'sans-serif is not monospaced'); }); @@ -229,7 +229,7 @@ suite.skip('Workbench - TerminalConfigHelper', () => { // {{SQL CARBON EDIT}} sk } }); - let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!); + let configHelper = new TerminalConfigHelper(LinuxDistro.Unknown, configurationService, null!, null!, null!, null!, null!, null!); configHelper.panelContainer = fixture; assert.equal(configHelper.configFontIsMonospace(), false, 'serif is not monospaced'); }); diff --git a/src/vs/workbench/contrib/update/electron-browser/update.ts b/src/vs/workbench/contrib/update/electron-browser/update.ts index 0560712825..cb3340c1bb 100644 --- a/src/vs/workbench/contrib/update/electron-browser/update.ts +++ b/src/vs/workbench/contrib/update/electron-browser/update.ts @@ -122,7 +122,7 @@ export class ProductContribution implements IWorkbenchContribution { @IStorageService storageService: IStorageService, @IInstantiationService instantiationService: IInstantiationService, @INotificationService notificationService: INotificationService, - @IEnvironmentService environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, @IOpenerService openerService: IOpenerService, @IConfigurationService configurationService: IConfigurationService, @IWindowService windowService: IWindowService, diff --git a/src/vs/workbench/contrib/webview/browser/webviewElement.ts b/src/vs/workbench/contrib/webview/browser/webviewElement.ts index b0961ed4e8..34b356c61b 100644 --- a/src/vs/workbench/contrib/webview/browser/webviewElement.ts +++ b/src/vs/workbench/contrib/webview/browser/webviewElement.ts @@ -7,7 +7,7 @@ import { Emitter } from 'vs/base/common/event'; import { URI } from 'vs/base/common/uri'; import { Webview, WebviewContentOptions, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview'; import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IFileService } from 'vs/platform/files/common/files'; import { Disposable } from 'vs/base/common/lifecycle'; import { areWebviewInputOptionsEqual } from 'vs/workbench/contrib/webview/browser/webviewEditorService'; @@ -40,14 +40,14 @@ export class IFrameWebview extends Disposable implements Webview { contentOptions: WebviewContentOptions, @IThemeService themeService: IThemeService, @ITunnelService tunnelService: ITunnelService, - @IEnvironmentService private readonly environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, @IFileService private readonly fileService: IFileService, @IConfigurationService private readonly _configurationService: IConfigurationService, ) { super(); const useExternalEndpoint = this._configurationService.getValue('webview.experimental.useExternalEndpoint'); - if (typeof environmentService.webviewEndpoint !== 'string' && !useExternalEndpoint) { + if (!useExternalEndpoint && (!environmentService.options || typeof environmentService.options.webviewEndpoint !== 'string')) { throw new Error('To use iframe based webviews, you must configure `environmentService.webviewEndpoint`'); } @@ -145,7 +145,7 @@ export class IFrameWebview extends Disposable implements Webview { private get endpoint(): string { const useExternalEndpoint = this._configurationService.getValue('webview.experimental.useExternalEndpoint'); - const baseEndpoint = useExternalEndpoint ? 'https://{{uuid}}.vscode-webview-test.com/8fa811108f0f0524c473020ef57b6620f6c201e1' : this.environmentService.webviewEndpoint!; + const baseEndpoint = useExternalEndpoint ? 'https://{{uuid}}.vscode-webview-test.com/8fa811108f0f0524c473020ef57b6620f6c201e1' : this.environmentService.options!.webviewEndpoint!; const endpoint = baseEndpoint.replace('{{uuid}}', this.id); if (endpoint[endpoint.length - 1] === '/') { return endpoint.slice(0, endpoint.length - 1); diff --git a/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.ts b/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.ts index f4f248962f..bae4f70075 100644 --- a/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.ts +++ b/src/vs/workbench/contrib/welcome/gettingStarted/electron-browser/gettingStarted.ts @@ -6,7 +6,7 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { ITelemetryService, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import * as platform from 'vs/base/common/platform'; import product from 'vs/platform/product/node/product'; import { IOpenerService } from 'vs/platform/opener/common/opener'; @@ -21,7 +21,7 @@ export class GettingStarted implements IWorkbenchContribution { constructor( @IStorageService private readonly storageService: IStorageService, - @IEnvironmentService environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService, @ITelemetryService private readonly telemetryService: ITelemetryService, @IOpenerService private readonly openerService: IOpenerService ) { diff --git a/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts b/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts index 59a6384572..e2f5d65c7a 100644 --- a/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts +++ b/src/vs/workbench/services/configurationResolver/test/electron-browser/configurationResolverService.test.ts @@ -20,7 +20,6 @@ import * as Types from 'vs/base/common/types'; import { EditorType } from 'vs/editor/common/editorCommon'; import { Selection } from 'vs/editor/common/core/selection'; import { WorkbenchEnvironmentService } from 'vs/workbench/services/environment/node/environmentService'; -import { parseArgs } from 'vs/platform/environment/node/argv'; import { IWindowConfiguration } from 'vs/platform/windows/common/windows'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; @@ -632,11 +631,7 @@ class MockInputsConfigurationService extends TestConfigurationService { class MockWorkbenchEnvironmentService extends WorkbenchEnvironmentService { - constructor(private env: platform.IProcessEnvironment) { - super(parseArgs(process.argv) as IWindowConfiguration, process.execPath); - } - - get configuration(): IWindowConfiguration { - return { userEnv: this.env } as IWindowConfiguration; + constructor(env: platform.IProcessEnvironment) { + super({ userEnv: env } as IWindowConfiguration, process.execPath); } } diff --git a/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts b/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts index 2f2e7c67e3..0b70ea812b 100644 --- a/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts +++ b/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts @@ -18,6 +18,7 @@ import { DialogChannel } from 'vs/platform/dialogs/node/dialogIpc'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ILayoutService } from 'vs/platform/layout/browser/layoutService'; import { IThemeService } from 'vs/platform/theme/common/themeService'; +import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; interface IMassagedMessageBoxOptions { @@ -45,12 +46,13 @@ export class DialogService implements IDialogService { @ILayoutService layoutService: ILayoutService, @IThemeService themeService: IThemeService, @IWindowService windowService: IWindowService, - @ISharedProcessService sharedProcessService: ISharedProcessService + @ISharedProcessService sharedProcessService: ISharedProcessService, + @IKeybindingService keybindingService: IKeybindingService ) { // Use HTML based dialogs if (configurationService.getValue('workbench.dialogs.customEnabled') === true) { - this.impl = new HTMLDialogService(logService, layoutService, themeService); + this.impl = new HTMLDialogService(logService, layoutService, themeService, keybindingService); } // Electron dialog service else { @@ -187,4 +189,4 @@ class NativeDialogService implements IDialogService { } } -registerSingleton(IDialogService, DialogService, true); \ No newline at end of file +registerSingleton(IDialogService, DialogService, true); diff --git a/src/vs/workbench/services/editor/browser/editorService.ts b/src/vs/workbench/services/editor/browser/editorService.ts index 71741a7f44..2d095ef01b 100644 --- a/src/vs/workbench/services/editor/browser/editorService.ts +++ b/src/vs/workbench/services/editor/browser/editorService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { IInstantiationService, ServicesAccessor, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; -import { IResourceInput, ITextEditorOptions, IEditorOptions } from 'vs/platform/editor/common/editor'; +import { IResourceInput, ITextEditorOptions, IEditorOptions, EditorActivation } from 'vs/platform/editor/common/editor'; import { IEditorInput, IEditor, GroupIdentifier, IFileEditorInput, IUntitledResourceInput, IResourceDiffInput, IResourceSideBySideInput, IEditorInputFactoryRegistry, Extensions as EditorExtensions, IFileInputFactory, EditorInput, SideBySideEditorInput, IEditorInputWithOptions, isEditorInputWithOptions, EditorOptions, TextEditorOptions, IEditorIdentifier, IEditorCloseEvent, ITextEditor, ITextDiffEditor, ITextSideBySideEditor, toResource, SideBySideEditor } from 'vs/workbench/common/editor'; import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput'; import { DataUriEditorInput } from 'vs/workbench/common/editor/dataUriEditorInput'; @@ -19,7 +19,7 @@ import { basename } from 'vs/base/common/resources'; import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput'; import { localize } from 'vs/nls'; import { IEditorGroupsService, IEditorGroup, GroupsOrder, IEditorReplacement, GroupChangeKind, preferredSideBySideGroupDirection } from 'vs/workbench/services/editor/common/editorGroupsService'; -import { IResourceEditor, ACTIVE_GROUP_TYPE, SIDE_GROUP_TYPE, SIDE_GROUP, IResourceEditorReplacement, IOpenEditorOverrideHandler, IVisibleEditor, IEditorService } from 'vs/workbench/services/editor/common/editorService'; +import { IResourceEditor, SIDE_GROUP, IResourceEditorReplacement, IOpenEditorOverrideHandler, IVisibleEditor, IEditorService, SIDE_GROUP_TYPE, ACTIVE_GROUP_TYPE } from 'vs/workbench/services/editor/common/editorService'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { Disposable, IDisposable, dispose, toDisposable, DisposableStore } from 'vs/base/common/lifecycle'; import { coalesce } from 'vs/base/common/arrays'; @@ -28,18 +28,16 @@ import { IEditorGroupView, IEditorOpeningEvent, EditorServiceImpl } from 'vs/wor import { ILabelService } from 'vs/platform/label/common/label'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { withNullAsUndefined } from 'vs/base/common/types'; +import { convertEditorInput, getFileMode } from 'sql/workbench/common/customInputConverter'; //{{SQL CARBON EDIT}} -//{{SQL CARBON EDIT}} -import { convertEditorInput, getFileMode } from 'sql/workbench/common/customInputConverter'; -//{{SQL CARBON EDIT}} - End - -type ICachedEditorInput = ResourceEditorInput | IFileEditorInput | DataUriEditorInput; +type CachedEditorInput = ResourceEditorInput | IFileEditorInput | DataUriEditorInput; +type OpenInEditorGroup = IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE; export class EditorService extends Disposable implements EditorServiceImpl { _serviceBrand!: ServiceIdentifier; - private static CACHE: ResourceMap = new ResourceMap(); + private static CACHE: ResourceMap = new ResourceMap(); //#region events @@ -220,46 +218,78 @@ export class EditorService extends Disposable implements EditorServiceImpl { //#region openEditor() - openEditor(editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise; - openEditor(editor: IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise; - openEditor(editor: IResourceDiffInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise; - openEditor(editor: IResourceSideBySideInput, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise; - openEditor(editor: IEditorInput | IResourceEditor, optionsOrGroup?: IEditorOptions | ITextEditorOptions | IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE, group?: GroupIdentifier): Promise { + openEditor(editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions, group?: OpenInEditorGroup): Promise; + openEditor(editor: IResourceInput | IUntitledResourceInput, group?: OpenInEditorGroup): Promise; + openEditor(editor: IResourceDiffInput, group?: OpenInEditorGroup): Promise; + openEditor(editor: IResourceSideBySideInput, group?: OpenInEditorGroup): Promise; + async openEditor(editor: IEditorInput | IResourceEditor, optionsOrGroup?: IEditorOptions | ITextEditorOptions | OpenInEditorGroup, group?: OpenInEditorGroup): Promise { + let resolvedGroup: IEditorGroup | undefined; + let candidateGroup: OpenInEditorGroup | undefined; + + let typedEditor: EditorInput | undefined; + let typedOptions: EditorOptions | undefined; // Typed Editor Support if (editor instanceof EditorInput) { - const editorOptions = this.toOptions(optionsOrGroup as IEditorOptions); - const targetGroup = this.findTargetGroup(editor, editorOptions, group); + typedEditor = editor; + typedOptions = this.toOptions(optionsOrGroup as IEditorOptions); - return this.doOpenEditor(targetGroup, editor, editorOptions); + candidateGroup = group; + resolvedGroup = this.findTargetGroup(typedEditor, typedOptions, candidateGroup); } // Untyped Text Editor Support - const textInput = editor; - const typedInput = this.createInput(textInput); - if (typedInput) { - const editorOptions = TextEditorOptions.from(textInput); - const targetGroup = this.findTargetGroup(typedInput, editorOptions, optionsOrGroup as IEditorGroup | GroupIdentifier); - return this.doOpenEditor(targetGroup, typedInput, editorOptions); + else { + const textInput = editor; + typedEditor = this.createInput(textInput); + if (typedEditor) { + typedOptions = TextEditorOptions.from(textInput); + + candidateGroup = optionsOrGroup as OpenInEditorGroup; + resolvedGroup = this.findTargetGroup(typedEditor, typedOptions, candidateGroup); + } } - return Promise.resolve(undefined); + if (typedEditor && resolvedGroup) { + if ( + this.editorGroupService.activeGroup !== resolvedGroup && // only if target group is not already active + typedOptions && !typedOptions.inactive && // never for inactive editors + typedOptions.preserveFocus && // only if preserveFocus + typeof typedOptions.activation !== 'number' && // only if activation is not already defined (either true or false) + candidateGroup !== SIDE_GROUP // never for the SIDE_GROUP + ) { + // If the resolved group is not the active one, we typically + // want the group to become active. There are a few cases + // where we stay away from encorcing this, e.g. if the caller + // is already providing `activation`. + // + // Specifically for historic reasons we do not activate a + // group is it is opened as `SIDE_GROUP` with `preserveFocus:true`. + // repeated Alt-clicking of files in the explorer always open + // into the same side group and not cause a group to be created each time. + typedOptions.overwrite({ activation: EditorActivation.ACTIVATE }); + } + + return this.doOpenEditor(resolvedGroup, typedEditor, typedOptions); + } + + return undefined; } - protected doOpenEditor(group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions): Promise { - return group.openEditor(editor, options).then(withNullAsUndefined); + protected async doOpenEditor(group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions): Promise { + return withNullAsUndefined(await group.openEditor(editor, options)); } - private findTargetGroup(input: IEditorInput, options?: IEditorOptions, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): IEditorGroup { + private findTargetGroup(input: IEditorInput, options?: IEditorOptions, group?: OpenInEditorGroup): IEditorGroup { let targetGroup: IEditorGroup | undefined; // Group: Instance of Group if (group && typeof group !== 'number') { - return group; + targetGroup = group; } // Group: Side by Side - if (group === SIDE_GROUP) { + else if (group === SIDE_GROUP) { targetGroup = this.findSideBySideGroup(); } @@ -347,9 +377,9 @@ export class EditorService extends Disposable implements EditorServiceImpl { //#region openEditors() - openEditors(editors: IEditorInputWithOptions[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise; - openEditors(editors: IResourceEditor[], group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise; - async openEditors(editors: Array, group?: IEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE): Promise { + openEditors(editors: IEditorInputWithOptions[], group?: OpenInEditorGroup): Promise; + openEditors(editors: IResourceEditor[], group?: OpenInEditorGroup): Promise; + async openEditors(editors: Array, group?: OpenInEditorGroup): Promise { // Convert to typed editors and options const typedEditors: IEditorInputWithOptions[] = []; @@ -379,22 +409,20 @@ export class EditorService extends Disposable implements EditorServiceImpl { }); } - // Open in targets + // Open in target groups const result: Promise[] = []; mapGroupToEditors.forEach((editorsWithOptions, group) => { result.push(group.openEditors(editorsWithOptions)); }); - const openedEditors = await Promise.all(result); - - return coalesce(openedEditors); + return coalesce(await Promise.all(result)); } //#endregion //#region isOpen() - isOpen(editor: IEditorInput | IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier): boolean { + isOpen(editor: IEditorInput | IResourceInput | IUntitledResourceInput): boolean { return !!this.doGetOpened(editor); } @@ -402,11 +430,11 @@ export class EditorService extends Disposable implements EditorServiceImpl { //#region getOpend() - getOpened(editor: IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier): IEditorInput | undefined { + getOpened(editor: IResourceInput | IUntitledResourceInput): IEditorInput | undefined { return this.doGetOpened(editor); } - private doGetOpened(editor: IEditorInput | IResourceInput | IUntitledResourceInput, group?: IEditorGroup | GroupIdentifier): IEditorInput | undefined { + private doGetOpened(editor: IEditorInput | IResourceInput | IUntitledResourceInput): IEditorInput | undefined { if (!(editor instanceof EditorInput)) { const resourceInput = editor as IResourceInput | IUntitledResourceInput; if (!resourceInput.resource) { @@ -414,20 +442,8 @@ export class EditorService extends Disposable implements EditorServiceImpl { } } - let groups: IEditorGroup[] = []; - if (typeof group === 'number') { - const groupView = this.editorGroupService.getGroup(group); - if (groupView) { - groups.push(groupView); - } - } else if (group) { - groups.push(group); - } else { - groups = [...this.editorGroupService.groups]; - } - // For each editor group - for (const group of groups) { + for (const group of this.editorGroupService.groups) { // Typed editor if (editor instanceof EditorInput) { @@ -574,7 +590,7 @@ export class EditorService extends Disposable implements EditorServiceImpl { throw new Error('Unknown input type'); } - private createOrGet(resource: URI, instantiationService: IInstantiationService, label: string | undefined, description: string | undefined, encoding: string | undefined, mode: string | undefined, forceFile: boolean | undefined): ICachedEditorInput { + private createOrGet(resource: URI, instantiationService: IInstantiationService, label: string | undefined, description: string | undefined, encoding: string | undefined, mode: string | undefined, forceFile: boolean | undefined): CachedEditorInput { if (EditorService.CACHE.has(resource)) { const input = EditorService.CACHE.get(resource)!; if (input instanceof ResourceEditorInput) { @@ -602,9 +618,8 @@ export class EditorService extends Disposable implements EditorServiceImpl { return input; } - let input: ICachedEditorInput; - // File + let input: CachedEditorInput; if (forceFile /* fix for https://github.com/Microsoft/vscode/issues/48275 */ || this.fileService.canHandleResource(resource)) { input = this.fileInputFactory.createFileInput(resource, encoding, mode, instantiationService); } @@ -645,7 +660,12 @@ export class EditorService extends Disposable implements EditorServiceImpl { } export interface IEditorOpenHandler { - (group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions | ITextEditorOptions): Promise; + ( + delegate: (group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions) => Promise, + group: IEditorGroup, + editor: IEditorInput, + options?: IEditorOptions | ITextEditorOptions + ): Promise; } /** @@ -682,7 +702,13 @@ export class DelegatingEditorService extends EditorService { return super.doOpenEditor(group, editor, options); } - const control = await this.editorOpenHandler(group, editor, options); + const control = await this.editorOpenHandler( + (group: IEditorGroup, editor: IEditorInput, options?: IEditorOptions) => super.doOpenEditor(group, editor, options), + group, + editor, + options + ); + if (control) { return control; // the opening was handled, so return early } diff --git a/src/vs/workbench/services/editor/test/browser/editorService.test.ts b/src/vs/workbench/services/editor/test/browser/editorService.test.ts index c0e982eeff..5abeb6a07f 100644 --- a/src/vs/workbench/services/editor/test/browser/editorService.test.ts +++ b/src/vs/workbench/services/editor/test/browser/editorService.test.ts @@ -330,7 +330,7 @@ suite.skip('EditorService', () => { // {{SQL CARBON EDIT}} skip suite const inp = instantiationService.createInstance(ResourceEditorInput, 'name', 'description', URI.parse('my://resource-delegate'), undefined); const delegate = instantiationService.createInstance(DelegatingEditorService); - delegate.setEditorOpenHandler((group: IEditorGroup, input: IEditorInput, options?: EditorOptions) => { + delegate.setEditorOpenHandler((delegate, group: IEditorGroup, input: IEditorInput, options?: EditorOptions) => { assert.strictEqual(input, inp); done(); diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts index 0fef8f7e2d..fc8b9784c5 100644 --- a/src/vs/workbench/services/environment/browser/environmentService.ts +++ b/src/vs/workbench/services/environment/browser/environmentService.ts @@ -96,11 +96,9 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment break: false }; - this.webviewEndpoint = options.webviewEndpoint; this.untitledWorkspacesHome = URI.from({ scheme: Schemas.untitled, path: 'Workspaces' }); if (document && document.location && document.location.search) { - const map = new Map(); const query = document.location.search.substring(1); const vars = query.split('&'); @@ -170,7 +168,6 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment verbose: boolean; skipGettingStarted: boolean; skipReleaseNotes: boolean; - skipAddToRecentlyOpened: boolean; mainIPCHandle: string; sharedIPCHandle: string; nodeCachedDataDir?: string; @@ -179,16 +176,15 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment disableCrashReporter: boolean; driverHandle?: string; driverVerbose: boolean; - webviewEndpoint?: string; galleryMachineIdResource?: URI; readonly logFile: URI; get webviewResourceRoot(): string { - return this.webviewEndpoint ? this.webviewEndpoint + '/vscode-resource{{resource}}' : 'vscode-resource:{{resource}}'; + return this.options.webviewEndpoint ? `${this.options.webviewEndpoint}/vscode-resource{{resource}}` : 'vscode-resource:{{resource}}'; } get webviewCspSource(): string { - return this.webviewEndpoint ? this.webviewEndpoint : 'vscode-resource:'; + return this.options.webviewEndpoint ? this.options.webviewEndpoint : 'vscode-resource:'; } } diff --git a/src/vs/workbench/services/environment/common/environmentService.ts b/src/vs/workbench/services/environment/common/environmentService.ts index 35224e309f..3a1d98dbf5 100644 --- a/src/vs/workbench/services/environment/common/environmentService.ts +++ b/src/vs/workbench/services/environment/common/environmentService.ts @@ -5,7 +5,7 @@ import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { IWindowConfiguration } from 'vs/platform/windows/common/windows'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IEnvironmentService, IDebugParams } from 'vs/platform/environment/common/environment'; import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api'; import { URI } from 'vs/base/common/uri'; @@ -17,7 +17,17 @@ export interface IWorkbenchEnvironmentService extends IEnvironmentService { readonly configuration: IWindowConfiguration; - readonly logFile: URI; - readonly options?: IWorkbenchConstructionOptions; + + readonly logFile: URI; + readonly logExtensionHostCommunication: boolean; + + readonly debugSearch: IDebugParams; + + readonly webviewResourceRoot: string; + readonly webviewCspSource: string; + + readonly skipGettingStarted: boolean | undefined; + readonly skipReleaseNotes: boolean | undefined; + } diff --git a/src/vs/workbench/services/environment/node/environmentService.ts b/src/vs/workbench/services/environment/node/environmentService.ts index c9ce7cdc04..22e80a0b3b 100644 --- a/src/vs/workbench/services/environment/node/environmentService.ts +++ b/src/vs/workbench/services/environment/node/environmentService.ts @@ -3,7 +3,7 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; +import { EnvironmentService, parseSearchPort } from 'vs/platform/environment/node/environmentService'; import { IWindowConfiguration } from 'vs/platform/windows/common/windows'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { memoize } from 'vs/base/common/decorators'; @@ -12,27 +12,36 @@ import { Schemas } from 'vs/base/common/network'; import { toBackupWorkspaceResource } from 'vs/workbench/services/backup/common/backup'; import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { join } from 'vs/base/common/path'; +import { IDebugParams } from 'vs/platform/environment/common/environment'; export class WorkbenchEnvironmentService extends EnvironmentService implements IWorkbenchEnvironmentService { _serviceBrand!: ServiceIdentifier; + readonly webviewResourceRoot = 'vscode-resource:{{resource}}'; + readonly webviewCspSource = 'vscode-resource:'; + constructor( - private _configuration: IWindowConfiguration, + readonly configuration: IWindowConfiguration, execPath: string ) { - super(_configuration, execPath); + super(configuration, execPath); - this._configuration.backupWorkspaceResource = this._configuration.backupPath ? toBackupWorkspaceResource(this._configuration.backupPath, this) : undefined; + this.configuration.backupWorkspaceResource = this.configuration.backupPath ? toBackupWorkspaceResource(this.configuration.backupPath, this) : undefined; } - get configuration(): IWindowConfiguration { - return this._configuration; - } + get skipGettingStarted(): boolean { return !!this.args['skip-getting-started']; } + + get skipReleaseNotes(): boolean { return !!this.args['skip-release-notes']; } @memoize get userRoamingDataHome(): URI { return this.appSettingsHome.with({ scheme: Schemas.userData }); } @memoize get logFile(): URI { return URI.file(join(this.logsPath, `renderer${this.configuration.windowId}.log`)); } + + get logExtensionHostCommunication(): boolean { return !!this.args.logExtensionHostCommunication; } + + @memoize + get debugSearch(): IDebugParams { return parseSearchPort(this.args, this.isBuilt); } } diff --git a/src/vs/workbench/services/extensions/common/extensionHostProcessManager.ts b/src/vs/workbench/services/extensions/common/extensionHostProcessManager.ts index 524a4d4056..70e78b96a7 100644 --- a/src/vs/workbench/services/extensions/common/extensionHostProcessManager.ts +++ b/src/vs/workbench/services/extensions/common/extensionHostProcessManager.ts @@ -8,7 +8,7 @@ import { Emitter, Event } from 'vs/base/common/event'; import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; import * as strings from 'vs/base/common/strings'; import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ExtHostCustomersRegistry } from 'vs/workbench/api/common/extHostCustomers'; import { ExtHostContext, ExtHostExtensionServiceShape, IExtHostContext, MainContext } from 'vs/workbench/api/common/extHost.protocol'; @@ -59,7 +59,7 @@ export class ExtensionHostProcessManager extends Disposable { private readonly _remoteAuthority: string, initialActivationEvents: string[], @IInstantiationService private readonly _instantiationService: IInstantiationService, - @IEnvironmentService private readonly _environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService, ) { super(); this._extensionHostProcessFinishedActivateEvents = Object.create(null); diff --git a/src/vs/workbench/services/extensions/common/remoteExtensionHostClient.ts b/src/vs/workbench/services/extensions/common/remoteExtensionHostClient.ts index d3965333a3..637b7c0660 100644 --- a/src/vs/workbench/services/extensions/common/remoteExtensionHostClient.ts +++ b/src/vs/workbench/services/extensions/common/remoteExtensionHostClient.ts @@ -5,7 +5,7 @@ import { Emitter, Event } from 'vs/base/common/event'; import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { ILabelService } from 'vs/platform/label/common/label'; import { ILogService } from 'vs/platform/log/common/log'; import { connectRemoteAgentExtensionHost, IRemoteExtensionHostStartParams, IConnectionOptions, ISocketFactory } from 'vs/platform/remote/common/remoteAgentConnection'; @@ -49,7 +49,7 @@ export class RemoteExtensionHostClient extends Disposable implements IExtensionH private readonly _initDataProvider: IInitDataProvider, private readonly _socketFactory: ISocketFactory, @IWorkspaceContextService private readonly _contextService: IWorkspaceContextService, - @IEnvironmentService private readonly _environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService, @ITelemetryService private readonly _telemetryService: ITelemetryService, @ILifecycleService private readonly _lifecycleService: ILifecycleService, @ILogService private readonly _logService: ILogService, diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts index 4fef7fb208..42115130ac 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionService.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionService.ts @@ -489,7 +489,14 @@ export class ExtensionService extends AbstractExtensionService implements IExten } // fetch the remote environment - const remoteEnv = (await this._remoteAgentService.getEnvironment())!; + const remoteEnv = (await this._remoteAgentService.getEnvironment()); + + if (!remoteEnv) { + this._notificationService.notify({ severity: Severity.Error, message: nls.localize('getEnvironmentFailure', "Could not fetch remote environment") }); + // Proceed with the local extension host + await this._startLocalExtensionHost(extensionHost, localExtensions, localExtensions.map(extension => extension.identifier)); + return; + } // enable or disable proposed API per extension this._checkEnableProposedApi(remoteEnv.extensions); diff --git a/src/vs/workbench/services/extensions/worker/extensionHostWorker.ts b/src/vs/workbench/services/extensions/worker/extensionHostWorker.ts index 9468017f36..a1e5513869 100644 --- a/src/vs/workbench/services/extensions/worker/extensionHostWorker.ts +++ b/src/vs/workbench/services/extensions/worker/extensionHostWorker.ts @@ -19,8 +19,8 @@ declare namespace self { let close: any; let postMessage: any; let addEventLister: any; - let indexedDB: any; - let caches: any; + let indexedDB: { open: any, [k: string]: any }; + let caches: { open: any, [k: string]: any }; } const nativeClose = self.close.bind(self); @@ -32,9 +32,8 @@ self.postMessage = () => console.trace(`'postMessage' has been blocked`); const nativeAddEventLister = addEventListener.bind(self); self.addEventLister = () => console.trace(`'addEventListener' has been blocked`); -// readonly, cannot redefine... -// self.indexedDB = undefined; -// self.caches = undefined; +self.indexedDB.open = () => console.trace(`'indexedDB.open' has been blocked`); +self.caches.open = () => console.trace(`'indexedDB.caches' has been blocked`); //#endregion --- diff --git a/src/vs/workbench/services/label/common/labelService.ts b/src/vs/workbench/services/label/common/labelService.ts index b5e0234ed6..20fcc21ea0 100644 --- a/src/vs/workbench/services/label/common/labelService.ts +++ b/src/vs/workbench/services/label/common/labelService.ts @@ -129,7 +129,10 @@ export class LabelService implements ILabelService { } getUriLabel(resource: URI, options: { relative?: boolean, noPrefix?: boolean, endWithSeparator?: boolean } = {}): string { - const formatting = this.findFormatting(resource); + return this.doGetUriLabel(resource, this.findFormatting(resource), options); + } + + private doGetUriLabel(resource: URI, formatting?: ResourceLabelFormatting, options: { relative?: boolean, noPrefix?: boolean, endWithSeparator?: boolean } = {}): string { if (!formatting) { return getPathLabel(resource.path, this.environmentService, options.relative ? this.contextService : undefined); } @@ -161,13 +164,16 @@ export class LabelService implements ILabelService { } getUriBasenameLabel(resource: URI): string { - const label = this.getUriLabel(resource); const formatting = this.findFormatting(resource); - if (formatting && formatting.separator === '\\') { - return paths.win32.basename(label); + const label = this.doGetUriLabel(resource, formatting); + if (formatting) { + switch (formatting.separator) { + case paths.win32.sep: return paths.win32.basename(label); + case paths.posix.sep: return paths.posix.basename(label); + } } - return paths.posix.basename(label); + return paths.basename(label); } getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IWorkspace), options?: { verbose: boolean }): string { diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index 42bdc80cd8..cc84789e92 100644 --- a/src/vs/workbench/services/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/services/preferences/browser/preferencesService.ts @@ -214,7 +214,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic private openSettings2(options?: ISettingsEditorOptions): Promise { const input = this.settingsEditor2Input; - return this.editorGroupService.activeGroup.openEditor(input, options) + return this.editorService.openEditor(input, options) .then(() => this.editorGroupService.activeGroup.activeControl!); } diff --git a/src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts b/src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts index d90e393457..361cd77e36 100644 --- a/src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts +++ b/src/vs/workbench/services/preferences/common/keybindingsEditorModel.ts @@ -160,14 +160,14 @@ export class KeybindingsEditorModel extends EditorModel { return result; } - resolve(editorActionsLabels: Map): Promise { + resolve(actionLabels: Map): Promise { const workbenchActionsRegistry = Registry.as(ActionExtensions.WorkbenchActions); this._keybindingItemsSortedByPrecedence = []; const boundCommands: Map = new Map(); for (const keybinding of this.keybindingsService.getKeybindings()) { if (keybinding.command) { // Skip keybindings without commands - this._keybindingItemsSortedByPrecedence.push(KeybindingsEditorModel.toKeybindingEntry(keybinding.command, keybinding, workbenchActionsRegistry, editorActionsLabels)); + this._keybindingItemsSortedByPrecedence.push(KeybindingsEditorModel.toKeybindingEntry(keybinding.command, keybinding, workbenchActionsRegistry, actionLabels)); boundCommands.set(keybinding.command, true); } } @@ -175,7 +175,7 @@ export class KeybindingsEditorModel extends EditorModel { const commandsWithDefaultKeybindings = this.keybindingsService.getDefaultKeybindings().map(keybinding => keybinding.command); for (const command of KeybindingResolver.getAllUnboundCommands(boundCommands)) { const keybindingItem = new ResolvedKeybindingItem(undefined, command, null, undefined, commandsWithDefaultKeybindings.indexOf(command) === -1); - this._keybindingItemsSortedByPrecedence.push(KeybindingsEditorModel.toKeybindingEntry(command, keybindingItem, workbenchActionsRegistry, editorActionsLabels)); + this._keybindingItemsSortedByPrecedence.push(KeybindingsEditorModel.toKeybindingEntry(command, keybindingItem, workbenchActionsRegistry, actionLabels)); } this._keybindingItems = this._keybindingItemsSortedByPrecedence.slice(0).sort((a, b) => KeybindingsEditorModel.compareKeybindingData(a, b)); return Promise.resolve(this); @@ -209,9 +209,9 @@ export class KeybindingsEditorModel extends EditorModel { return a.command.localeCompare(b.command); } - private static toKeybindingEntry(command: string, keybindingItem: ResolvedKeybindingItem, workbenchActionsRegistry: IWorkbenchActionRegistry, editorActions: Map): IKeybindingItem { + private static toKeybindingEntry(command: string, keybindingItem: ResolvedKeybindingItem, workbenchActionsRegistry: IWorkbenchActionRegistry, actions: Map): IKeybindingItem { const menuCommand = MenuRegistry.getCommand(command)!; - const editorActionLabel = editorActions.get(command)!; + const editorActionLabel = actions.get(command)!; return { keybinding: keybindingItem.resolvedKeybinding, keybindingItem, @@ -264,13 +264,13 @@ class KeybindingItemMatches { this.commandLabelMatches = keybindingItem.commandLabel ? this.matches(searchValue, keybindingItem.commandLabel, (word, wordToMatchAgainst) => matchesWords(word, keybindingItem.commandLabel, true), words) : null; this.commandDefaultLabelMatches = keybindingItem.commandDefaultLabel ? this.matches(searchValue, keybindingItem.commandDefaultLabel, (word, wordToMatchAgainst) => matchesWords(word, keybindingItem.commandDefaultLabel, true), words) : null; this.sourceMatches = this.matches(searchValue, keybindingItem.source, (word, wordToMatchAgainst) => matchesWords(word, keybindingItem.source, true), words); - this.whenMatches = keybindingItem.when ? this.matches(searchValue, keybindingItem.when, or(matchesWords, matchesCamelCase), words) : null; + this.whenMatches = keybindingItem.when ? this.matches(null, keybindingItem.when, or(matchesWords, matchesCamelCase), words) : null; } this.keybindingMatches = keybindingItem.keybinding ? this.matchesKeybinding(keybindingItem.keybinding, searchValue, keybindingWords, completeMatch) : null; } - private matches(searchValue: string, wordToMatchAgainst: string, wordMatchesFilter: IFilter, words: string[]): IMatch[] | null { - let matches = wordFilter(searchValue, wordToMatchAgainst); + private matches(searchValue: string | null, wordToMatchAgainst: string, wordMatchesFilter: IFilter, words: string[]): IMatch[] | null { + let matches = searchValue ? wordFilter(searchValue, wordToMatchAgainst) : null; if (!matches) { matches = this.matchesWords(words, wordToMatchAgainst, wordMatchesFilter); } diff --git a/src/vs/workbench/services/preferences/common/preferences.ts b/src/vs/workbench/services/preferences/common/preferences.ts index d536a475e9..4ae383dcb2 100644 --- a/src/vs/workbench/services/preferences/common/preferences.ts +++ b/src/vs/workbench/services/preferences/common/preferences.ts @@ -167,20 +167,12 @@ export class SettingsEditorOptions extends EditorOptions implements ISettingsEdi static create(settings: ISettingsEditorOptions): SettingsEditorOptions { const options = new SettingsEditorOptions(); + options.overwrite(settings); options.target = settings.target; options.folderUri = settings.folderUri; options.query = settings.query; - // IEditorOptions - options.preserveFocus = settings.preserveFocus; - options.forceReload = settings.forceReload; - options.revealIfVisible = settings.revealIfVisible; - options.revealIfOpened = settings.revealIfOpened; - options.pinned = settings.pinned; - options.index = settings.index; - options.inactive = settings.inactive; - return options; } } diff --git a/src/vs/workbench/services/progress/browser/progressService.ts b/src/vs/workbench/services/progress/browser/progressService.ts index 060471a418..d07d39ba51 100644 --- a/src/vs/workbench/services/progress/browser/progressService.ts +++ b/src/vs/workbench/services/progress/browser/progressService.ts @@ -348,7 +348,9 @@ export class ProgressService extends Disposable implements IProgressService { const disposables = new DisposableStore(); const allowableCommands = [ 'workbench.action.quit', - 'workbench.action.reloadWindow' + 'workbench.action.reloadWindow', + 'copy', + 'cut' ]; let dialog: Dialog; diff --git a/src/vs/workbench/services/request/browser/requestService.ts b/src/vs/workbench/services/request/browser/requestService.ts index 79bdbf4fe5..b7a58e42dd 100644 --- a/src/vs/workbench/services/request/browser/requestService.ts +++ b/src/vs/workbench/services/request/browser/requestService.ts @@ -3,7 +3,7 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IRequestOptions, IRequestContext } from 'vs/platform/request/common/request'; +import { IRequestOptions, IRequestContext } from 'vs/base/parts/request/common/request'; import { CancellationToken } from 'vs/base/common/cancellation'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ILogService } from 'vs/platform/log/common/log'; diff --git a/src/vs/workbench/services/search/node/searchService.ts b/src/vs/workbench/services/search/node/searchService.ts index 01eb296d96..76c2d3bcc2 100644 --- a/src/vs/workbench/services/search/node/searchService.ts +++ b/src/vs/workbench/services/search/node/searchService.ts @@ -12,7 +12,8 @@ import { URI as uri } from 'vs/base/common/uri'; import { getNextTickChannel } from 'vs/base/parts/ipc/common/ipc'; import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IDebugParams, IEnvironmentService } from 'vs/platform/environment/common/environment'; +import { IDebugParams } from 'vs/platform/environment/common/environment'; +import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IFileService } from 'vs/platform/files/common/files'; import { ILogService } from 'vs/platform/log/common/log'; import { FileMatch, IFileMatch, IFileQuery, IProgressMessage, IRawSearchService, ISearchComplete, ISearchConfiguration, ISearchProgressItem, ISearchResultProvider, ISerializedFileMatch, ISerializedSearchComplete, ISerializedSearchProgressItem, isSerializedSearchComplete, isSerializedSearchSuccess, ITextQuery, ISearchService } from 'vs/workbench/services/search/common/search'; @@ -35,7 +36,7 @@ export class LocalSearchService extends SearchService { @ILogService logService: ILogService, @IExtensionService extensionService: IExtensionService, @IFileService fileService: IFileService, - @IEnvironmentService readonly environmentService: IEnvironmentService, + @IWorkbenchEnvironmentService readonly environmentService: IWorkbenchEnvironmentService, @IInstantiationService readonly instantiationService: IInstantiationService ) { super(modelService, untitledEditorService, editorService, telemetryService, logService, extensionService, fileService); diff --git a/src/vs/workbench/services/textfile/common/textFileService.ts b/src/vs/workbench/services/textfile/common/textFileService.ts index cdc806a076..ca73a577c0 100644 --- a/src/vs/workbench/services/textfile/common/textFileService.ts +++ b/src/vs/workbench/services/textfile/common/textFileService.ts @@ -685,7 +685,7 @@ export abstract class TextFileService extends Disposable implements ITextFileSer protected async promptForPath(resource: URI, defaultUri: URI, availableFileSystems?: string[]): Promise { // Help user to find a name for the file by opening it first - await this.editorService.openEditor({ resource, options: { revealIfOpened: true, preserveFocus: true, } }); + await this.editorService.openEditor({ resource, options: { revealIfOpened: true, preserveFocus: true } }); return this.fileDialogService.pickFileToSave(this.getSaveDialogOptions(defaultUri, availableFileSystems)); } diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts index ad72e7d886..b58504822c 100644 --- a/src/vs/workbench/test/workbenchTestServices.ts +++ b/src/vs/workbench/test/workbenchTestServices.ts @@ -710,6 +710,10 @@ export class TestEditorGroupsService implements IEditorGroupsService { throw new Error('not implemented'); } + restoreGroup(_group: number | IEditorGroup): IEditorGroup { + throw new Error('not implemented'); + } + getSize(_group: number | IEditorGroup): { width: number, height: number } { return { width: 100, height: 100 }; } diff --git a/src/vs/workbench/workbench.web.api.ts b/src/vs/workbench/workbench.web.api.ts index e2b88e544f..0207a117fd 100644 --- a/src/vs/workbench/workbench.web.api.ts +++ b/src/vs/workbench/workbench.web.api.ts @@ -11,6 +11,7 @@ import { IWebSocketFactory } from 'vs/platform/remote/browser/browserSocketFacto import { ICredentialsProvider } from 'vs/workbench/services/credentials/browser/credentialsService'; import { IExtensionManifest } from 'vs/platform/extensions/common/extensions'; import { IURLCallbackProvider } from 'vs/workbench/services/url/browser/urlService'; +import { IProductConfiguration } from 'vs/platform/product/common/product'; export interface IWorkbenchConstructionOptions { @@ -71,6 +72,11 @@ export interface IWorkbenchConstructionOptions { * Experimental: Support for URL callbacks. */ urlCallbackProvider?: IURLCallbackProvider; + + /** + * Experimental: Support for product configuration. + */ + productConfiguration?: IProductConfiguration; } /** diff --git a/test/splitview/public/index.html b/test/splitview/public/index.html index 602682d6aa..2df7131614 100644 --- a/test/splitview/public/index.html +++ b/test/splitview/public/index.html @@ -31,51 +31,131 @@ - \ No newline at end of file +