* Add a share menu
Fixes#146309
* Add vscod.dev command in github extension
* Make share menu proposed
* Add share submenu into editor context
* Add proposed to editor share menu
* Markdown path completions tests use mocked out fs
This updates the path completion tests to stop depending on the actual fs and instead use `IMdWorkspace`
* Update remaining tests
- When splitting `text/uri-list`, we should split on `\n` to handle against spec versions of `text/uri-list`
- However when constructing a `text/uri-list`, we should use `\r\n` to align with the spec
This splits the markdown link tests in two:
- Tests for detecting links in md files (`MdLinkComputer`)
- Tests for the actual vs code editor link provider
Also fixes a few cases splitting these tests up caught
Renames in the markdown extension
This renames some types and splits up some files as part of an exploration towards a proper LSP. Changes:
- `SkinnyTextDocument` -> `ITextDocument`
- Moved `ITextDocument` to own file
- `MdWorkspaceContents` -> `IMdWorkspace`
* introduce application config model
- application configuration is active and used only in non default profiles
- read/write application scoped settings only from application layer and not from user layer
- extensions get application scoped values as global values
- settings editor does not show application scoped settings in non default profle
- added unit tests
* fix tests
This creates a common set of functions for creating and parsing the `text/uri-list` mime type. As part of this, I also aligned us with the standard, which uses `\r\n` between lines instead of just `\n`
Turns on pasting of links for easier testing. However `editor.experimental.pasteActions.enabled` is still off by default so this won't be enabled by default
* Reduce recomputation of state in markdown extension
- Use `getForDocument` more often to avoid refetching documents
- Debounce `MdTableOfContentsWatcher`. We don't want this to trigger on every keystroke :)
* Cache LinkDefinitionSet
* Add test file change
* Fix toc watcher for tests
This change reduces the number of times we retokenize a markdown file by doing the following:
- Use `MdTableOfContentsProvider` in more places
- Introduce a `IMarkdownParser` interface that lets us drop in a caching version of the tokenizer
* Optimize markdown workspace scanning
- Adds cache for markdown file
- Avoid reading non-markdown files from disk (when we expect markdown files)
- Use `range.contains(pos)` instead of `range.intersects(range)`
* Don't remove cached document on change
We only want to invalidate the cached document when it is first opened (since the cached version is the one from disk). Otherwise we can use the live version of the doc
* Improve markdown link regexp
This makes the markdown link regexp more readable and also combines the two regular expressions we were running
* Fixed backtracking
We currently re-compute the same table of contents for markdown files multiple times. This is because multiple language features all need table of contents
With this change, we introduce a new `TableOfContentsProvider` which maintains a cache of the table of contents per file. This provider is then passed into every caller that needs a toc
(sorry for the size of this PR)
This change cleans up the markdown language features by making the following changes:
- Use `registerXSupport` public functions to register these
- Expose the slugifier the `MarkdownEngine` uses. You never want to use a different one if you already have a markdown engine
- Sort of clean up names. I'd introduced a bunch of confusing names while iterating in this space. What I'm working towards:
- `Computer` — Stateless thing that computer data
- `Provider` — Potentially stateful thing that provides data (which may be cached)
- `VsCodeProvider` — The actual implementation of the various vscode language features (which should only be used by VS Code and in tests, not shared with other features)
- Introduce `MdLinkProvider` to avoid recomputing links for a given document. Also use this to hide more internals of link computation
* Add test for MD diagnostic manager config changes
Add a simple test the enabling/disable diagnostics should make the diagnostic manager recompute diagnostics
* Add `.get`
* Clean up markdown diagnostic tests
This splits the diagnostic compute tests from the test for the diagnostic manager
* Mark internal field as private
This change renames the main markdown reference provider class to `MdReferenceComputer` and then uses this to implement a `vscode.ReferenceProvider`
This more cleanly splits the VS Code part of the logic from the general reference calculation stuff other providers consume
* Fix ranges and validation setting for MD own path + header links
Previously for a `file.md`, links to headers in that file that use paths, such as `[link](./file.md#some-header)` were validated using `markdown.experimental.validate.fragmentLinks.enabled`
This is confusing as that setting was only meant to be used for links such as`[link](#some-header`). It also resulted in the diagnostic having the incorrect range
This change instead makes these links be validated by `markdown.experimental.validate.fileLinks.markdownFragmentLinks`
* Fix compile
Switches simple patterns like:
```ts
if (some.thing) {
some.thing.method();
}
```
to:
```ts
some.thing?.method()
```
This is more concise and avoids having to repeat the `some.thing` part
transpile-only tasks for client and extensions
* extract transpile into its own file
* add transpile-client task, polish transpiler
* add transpile-extensions, improve transpile logic
* move declaration of "const enum" above it usage so that it can be used with const-enum-inlining
* (ugly) make d.ts transpilation configurable because it is needed for extensions but a problem for client
* hack my way around so that `getOwnEmitOutputFilePath` is reusable by our transpile
* honor `noEmit` flag
* Add support for SSH Uri
* Update extensions/git/src/protocolHandler.ts
Co-authored-by: João Moreno <joao.moreno@microsoft.com>
Co-authored-by: João Moreno <joao.moreno@microsoft.com>
Affects #139247
This PR changes Emmet to use inline completions when suggesting completions.
It also provides a boolean setting so that users can opt out.
This PR does not change the "Wrap with Abbreviation" behaviour in Emmet.
Co-authored-by: Henning Dieterichs <notify.henning.dieterichs@live.de>
Clairify markdown validate settings
Fixes#150949
- Rename headerLinks -> fragmentLinks
- Add new `fileLink.markdownFragmentsLinks` to validate the headers on fragment links (inherits the default setting value from `fragmentLinks`)
* Remove the notebookEditorDecorationType API proposal
Fixes#146838
* Remove all the infastructure around the now removed notebookEditorDecorationType api
- use merge editor for conflicts
- expose base resource in resource syncrhonziers
- add baseResourceScheme context to contribute Accept Merge button per feature
- support old way of handling conflicts behind an internal setting
* 🔨 Set ignoreFocusOut to true on PR template selection
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
* 🔨 Translate PR template paths to relative in quick pick list
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
* 💄 Shorten line length
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
* ⚗️ Update tests with latest required args
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
* ⚗️ Update GitHub extension unit tests
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
Co-authored-by: João Moreno <joao.moreno@microsoft.com>
This updates the text editor drop proposal (#142990). This change introduces `DocumentDropEdit` which removes the need for `SnippetTextEdit`. This interface may also be extended in the future with additional metadata
* Iterate on paste edit provider api
For #30066
- Pass all selections to paste providers. For #151326
- Introduce `DocumentPasteEdit` as return type. This new type uses an `insertText` that is applied to every paste location (for multicursor), plus an optional additional edit
- Add `DocumentPasteProviderMetadata`. This lets extensions tell us which types of mimetypes they are interested in, letting us avoid round trips if no extensions care about the pasted data
* Correctly batch insertText
This change introduces a `ResoruceMap` map type that is essentially `Map<vscode.Uri, T>`
It also fixes a potential race condition with `MdWorkspaceCache` where two quick calls would both trigger init
From https://github.com/microsoft/TypeScript/pull/48529
Let users control is variable type inlay hints are suppresed if the variable name matches the type name, such as:
```ts
const range = new Range();
```
The `picomatch` library currently checks `process.platform`. This check fails on web, which causes the markdown extension to not load
To fix this, I'm replacing `process.platform` with the string`'web'`
For #30066
This adds a new `documentPaste` api proposal that lets extensions hook into copy and paste.
This can be used to do things such as:
- Create link when pasting an image
- Bring along imports when copy and pasting code
* Bump default JS target for scripts in html
For JS/TS files, we target ES2020 by default. However in html files we're still stuck targetting es6
This change aligns the two
* use es2020.full (includes dom), fix web, avoid searching in node_modules
Co-authored-by: Martin Aeschlimann <martinae@microsoft.com>
This change lets you ignore all links to a given file, even if those links include a header. For example: `[text](/path/to/file#some-header)` can be ignored using `/path/to/file`
* Finalize NotebookEditor api proposal
Fixes#149271
This finalizes most parts of the NotebookEditor api proposal. I haven't removed the proposal entirely as there are still a few parts being left behind:
- The deprecated properties/functions
- A few contribution points such as `notebook/cell/executePrimary`
* remove extra quote
This change renames the experimental skipPaths setting to ignoreLinks. This setting applies to all types of links, and can also be used to ignore links to headers
When reloading windows that need to restore a markdown preview, sometimes I'll see an error when the markdown preview tries accessing a disposed of webview. This seems to be cause caused by `provideTextDocumentContent`, where we end up disposing of the webview before an `await` resumes execution
For #121256
This change adds the current `ouputItem` to the notebook markdown renderer's environment
Renders that extend our markdown renderer can use this to access output item metadata for example
The new `markdown.experimental.validate.fileLinks.skipPaths` setting lets you specify a list of paths (as globs) that should not be validation
This is useful since markdown is used in a range of environments, and sometimes you may need to link to paths that don't exist on disk but will exist on deployment
A few other changes here:
- Adds a quick fix that adds paths to `skipPaths`
- Rename existing settings to use the `.enabled` prefix
- This makes the body of the pull request non-empty when the commit message consists more than one line.
- The GitHub web client fills the body the same way, too, when you create a pull request.
- Some commit messages consist more than one line, like this one, which is giving more detail about the commit, and can be used as a shortcut to not write the same text when opening a pull request and on GitHub.
- Without these changes, the pull request title will be messed up if the commit message is similar to this.
Co-authored-by: João Moreno <joao.moreno@microsoft.com>
* Initial updates
* Add border radius
* Address PR feedback
* Fix typo
* Update shadow blur
* Update LR padding and use description foreground for shortcuts
* Typo
* Fix separator padding/margin
* fix jumpy items in hc themes
* Fix shadow and border radius
* Use opacity for keybinding for better color blend
* Update min width and container padding T/B
* Revert actionbar margin and remove unnecessary menu css file
* Ensure menus respect 0 horizontal margin rule
* set bg/fg color on menu container
* better fix for jumpy menu items
* use outline instead of border
* clean up dead css in style.css
fix opacity for separators in menus
* bring back vertical action bar margins
* Remove old CSS import
Co-authored-by: SteVen Batten <sbatten@microsoft.com>
For #146303
This PR updates the markdown diagnostic reporter to watch linked to files. If one of these linked to files is created or deleted, we recompute the diagnostics for all markdown files that linked to it
For markdown such as `<scope:tag>b</scope:tag>`, we currently detect `<scope:tag>` as an uri (an autolink) and then try validating it as a file path
This change doesn't fix `<scope:tag>` being detected as a link (which is actually correct if there isn't closing html), but does fix the us trying to validate it by marking the uri as external
* Add "Open Containing Folder" etc to file context menu in Git SCM view
Caption is "Reveal in Finder" on macOS and "Reveal in File Explorer" on Windows.
This resolves#137828
* Use multiple decorators on a method to simplify code
Fixes#149406
Make sure that escaping the leading `[` of a reference link means it is not considered a link
- Picks up new grammar with fixes
- Updates our document link provider to also not consider these as link
* Remove the textDocumentNotebook API proposal
All consumers have now been migrated off of this proposal, so it is safe to remove from our code
* Remove deprecated api usage from test
We currently validate each link in a markdown file individually. This means that if there are multiple links to the same file, we check if that file exists multiple times
With this change, we instead will check that the file exists once and then use this to add diagnostics for all the links to it. This is done by introducing a new `FileLinkMap` which maps file paths to links within that file
Fixes#14912310c8c1c2cc made sure we sync over the authority of in-memory resources over to TS Server. However if a resource does not have an authority, this resulted in a url with `scheme//path` instead of `scheme/authority/path`
TS would then normalize the uri to `scheme/path`, resulting in us considering this a new resource
This fix adds an explicit empty authority that we use in this case instead
This tracks inflight diagnostic computation and tries to cancel them if a new request comes in for the same document (usually because the document has changed or has been closed)
For #146853
Make sure we include the uri authority when serializing and then restoring the file paths we send to TSServer (similarly to how we already handle the uri scheme)