The Wayback Machine - https://web.archive.org/web/20200620002748/https://github.com/microsoft/vscode
Skip to content
Visual Studio Code
TypeScript JavaScript CSS Inno Setup HTML Shell
Branch: master
Clone or download

Latest commit

mjbvz and alexdima Let core command such as undo/redo be overridden by webviews and note…
…books (#98288)

* Add CoreCommandService

For #90110

This change introduce a new service (`ICoreCommandService`) that lets high levels parts of the editor (such as webviews) hook into core commands such as undo and redo that are fired from the editor menus.

## Why is this needed?
To implement undo/redo in custom editors / webviews, we currently register special commands (`editor.action.customEditor.undo` and `editor.action.customEditor.redo`). This is not ideal since it means that users have to update multiple commands if they wish to rebind undo/redo

These custom command also are not invoked when the user goes to the `edit` menu and select `undo` or `redo`. Instead, the edit menu always calls the core `UndoCommand`

We cannot make `UndoCommand` know about custom editors because it lives in `base`

## What this change does?
This change adds a new `ICoreCommandService` that lets higher level parts of the editor override core commands such as undo and redo. We use a similar approach in the `IOpenerService`.

Right now only `undo` and `redo` are overridable. If this approach looks ok, we could also extend it to `copy`, `paste`, `cut`, and `select all`

* Add docs and clean up types

* Rework implementation

Switch from using a command service to having each command state if is overrideable or not.

This hooks up overrides for:

- Undo/redo
- cut/copy/paste

for webviews, custom editors, and notebooks

* Add ProxyCommand so that multiple registered commands can share a single implementation

* Fix compilation & missing file being referenced

* Introduce and adopt MultiCommand for Undo

* Adopt MultiCommand for Redo and SelectAll

* Adopt MultiCommand for Cut, Copy and Paste

Co-authored-by: Alex Dima <alexdima@microsoft.com>
Latest commit 97650fb Jun 19, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github close #100588 Jun 19, 2020
.vscode move perf data into separate file that's ignored by search, fyi @sand… Jun 18, 2020
build switch to use iconv-lite-umd for #79275 (#100472) Jun 18, 2020
extensions [json] server path fix (for json-server npm) Jun 19, 2020
remote upgrade semver Jun 19, 2020
resources code.sh: loosen check for WSL2 Jun 19, 2020
scripts Fixes #99666 - moves code-web into resources/ Jun 9, 2020
src Let core command such as undo/redo be overridden by webviews and note… Jun 19, 2020
test sandbox - configure nativeWindowOpen:true Jun 16, 2020
.editorconfig No forcing tabsize on users Dec 19, 2018
.eslintignore remove polyfill promise Mar 2, 2020
.eslintrc.json Update eslint versions Jun 5, 2020
.gitattributes attributes: rtf files are not text Mar 19, 2019
.gitignore CI for Monaco Editor compile and bundling. Nov 12, 2019
.mailmap Add self to mailmap Dec 30, 2019
.mention-bot update mention bot configuration Jul 11, 2016
.nvmrc Update .nvmrc Mar 18, 2019
.yarnrc chore: bump electron@8.3.3 Jun 19, 2020
CONTRIBUTING.md Update link for automated issue management actions repository (#96568) Apr 29, 2020
LICENSE.txt remove blank line (my best checkin ever) May 1, 2020
README.md changed build (#98857) Jun 2, 2020
ThirdPartyNotices.txt Run OSS tool for v1.46 and update distro hash Jun 3, 2020
azure-pipelines.yml use macOS-latest hosted agent Jan 24, 2020
cglicenses.json release: prep for 1.45 Apr 28, 2020
cgmanifest.json chore: bump electron@8.3.3 Jun 19, 2020
gulpfile.js remove gulpfile.ci Jul 2, 2019
package.json chore: bump electron@8.3.3 Jun 19, 2020
product.json update reference viewlet Jun 17, 2020
tsfmt.json fix hygiene Mar 6, 2018
yarn.lock chore: bump electron@8.3.3 Jun 19, 2020

README.md

Visual Studio Code - Open Source ("Code - OSS")

Build Status Feature Requests Bugs Gitter

The Repository

This repository ("Code - OSS") is where we (Microsoft) develop the Visual Studio Code product. Not only do we work on code and issues here, we also publish our roadmap, monthly iteration plans, and our endgame plans. This source code is available to everyone under the standard MIT license.

Visual Studio Code

VS Code in action

Visual Studio Code is a distribution of the Code - OSS repository with Microsoft specific customizations released under a traditional Microsoft product license.

Visual Studio Code combines the simplicity of a code editor with what developers need for their core edit-build-debug cycle. It provides comprehensive code editing, navigation, and understanding support along with lightweight debugging, a rich extensibility model, and lightweight integration with existing tools.

Visual Studio Code is updated monthly with new features and bug fixes. You can download it for Windows, macOS, and Linux on Visual Studio Code's website. To get the latest releases every day, install the Insiders build.

Contributing

There are many ways in which you can participate in the project, for example:

If you are interested in fixing issues and contributing directly to the code base, please see the document How to Contribute, which covers the following:

Feedback

Related Projects

Many of the core components and extensions to VS Code live in their own repositories on GitHub. For example, the node debug adapter and the mono debug adapter have their own repositories. For a complete list, please visit the Related Projects page on our wiki.

Bundled Extensions

VS Code includes a set of built-in extensions located in the extensions folder, including grammars and snippets for many languages. Extensions that provide rich language support (code completion, Go to Definition) for a language have the suffix language-features. For example, the json extension provides coloring for JSON and the json-language-features provides rich language support for JSON.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT license.

You can’t perform that action at this time.