Commit Graph

1225 Commits

Author SHA1 Message Date
Johannes
3622010b64 Merge branch 'main' into joh/voluminous-lobster 2022-06-09 09:08:20 +02:00
Matt Bierner
d7c90c2b2b Update text editor drop proposal (#151552)
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
2022-06-08 17:44:28 -04:00
Matt Bierner
48cfaa2187 Fix rename of paths in markdown reference link definitions (#151545)
Fixes #151117
2022-06-08 19:20:17 +00:00
Matt Bierner
370dfd5fee Iterate on paste edit provider api (#151477)
* 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
2022-06-08 15:06:55 -04:00
Johannes
0656d21d11 auto-fixed prefer-const violation 2022-06-08 17:49:21 +02:00
Matt Bierner
1327d1eb50 Adopt ResourceMap in more places (#151475)
This changes switches to use the new `ResourceMap` type in more places in the markdown extension where we need to have a map/set with uris as the key
2022-06-08 08:34:06 +02:00
Matt Bierner
60a68d666d Add resourceMap helper for markdown extension (#151471)
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
2022-06-07 18:00:10 -07:00
Matt Bierner
9545af80f6 Fix markdown link detection for links with titles (#151459)
Fixes #151458
2022-06-07 20:58:29 +00:00
Justin Chen
bcc7ffae3e bugfix on markdown underlines, addressing part of issue #136073 (#151178)
Co-authored-by: Justin Chen <t-justinchen@microsoft.com>
Co-authored-by: Matt Bierner <matb@microsoft.com>
2022-06-06 17:35:41 +00:00
Logan Ramos
70647a2ffd Fix #150041 (#151108) 2022-06-02 11:02:26 -04:00
Matt Bierner
e44f4ba886 Add experimental tag to experimental extension settings (#151031)
This makes a few more extension settings with the `experimental` tag so that show up if you search `@tag:experimental`
2022-06-01 16:32:58 -07:00
Matt Bierner
9302343e8e Also ignore star checkboxes (#151029)
Fixes #150672

This makes our md link detection also ignore checkboxes like `* [x]` instead of just `- [x]`
2022-06-01 21:23:29 +00:00
Matt Bierner
7477efd87e Better message for markdown reference links (#151018)
Fixes #151017

Also improves the diagnostic message for invalid reference links to make it clear we are talking about a missing link definition
2022-06-01 19:01:36 +00:00
Matt Bierner
e6fff5ecff Don't parse checkboxes are links in markdown (#150914)
Fixes #150672
2022-05-31 14:57:32 -07:00
Matt Bierner
e4f7f6a9da Add PasteEditProvider (#107283)
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
2022-05-25 12:27:58 +02:00
Matt Bierner
1c7991f1e8 Markdown ignoreLink should apply to paths in header links (#150223)
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`
2022-05-23 17:07:15 -07:00
Matt Bierner
b8420578fd Add additional allowed tags in untrusted notebook markdown (#150228)
This adds some extra allowed tags when rendering markdown in notebooks. Additions are:

```
  "b",

    "br",

    "caption",

    "center",

    "col",

    "colgroup",

    "details",

    "em",

    "font",

    "i",

    "kbd",

    "sub",

    "summary",

    "sup",

    "table",

    "tbody",

    "tfoot",

    "thead",

    "td",

    "th",

    "tr",

    "tt",

    "u",

    "video"
```
2022-05-23 22:30:42 +00:00
Matt Bierner
96cae45ba9 Rename skipPaths to ignoreLinks (#150064)
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
2022-05-20 22:54:21 +00:00
Esteban Dalel R
e76ad21903 Fix typo (#150042) 2022-05-20 19:06:35 +00:00
Matt Bierner
993c36c920 Fix markdown ext errors accessing disposed webview (#149960)
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
2022-05-20 09:17:57 -07:00
Matt Bierner
0d55d50173 Expose outputItem in notebook markdown eve (#149870)
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
2022-05-18 16:14:32 -07:00
Matt Bierner
27903c28aa Remove unfinished test (#149864)
Mistakenly checked this in
2022-05-18 16:01:28 -07:00
Matt Bierner
daf0d5e551 Add skipPaths option for markdown link validation (#149859)
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
2022-05-18 14:37:08 -07:00
Matt Bierner
1c7ab35761 Rename to DocumentOnDropEditProvider (#149730)
This change renames `DocumentOnDropProvider` to `DocumentOnDropEditProvider`. This new name aligns with the existing `DocumentFormattingEditProvider`
2022-05-17 09:26:54 -07:00
Matt Bierner
c2b064538b Don't detect links in markdown code blocks (#149680)
Fixes #149678
2022-05-16 17:35:16 -07:00
Matt Bierner
d71f6ec0d9 Update markdown diagnostics when linked files change (#149672)
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
2022-05-16 17:30:39 -07:00
Matt Bierner
dd9dca9825 Fixing some html tags detected as autolinks for diagnostics (#149511)
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
2022-05-16 12:19:29 +02:00
Matt Bierner
113287ccc3 Don't treat escaped markdown reference links as links (#149407)
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
2022-05-12 19:35:36 -07:00
Matt Bierner
a075453e55 Clean up the markdown document link provider tests (#149405)
- Use `joinLines` instead of
- Inline document text
- Always use `example.com`
- Move issue numbers into test titles
- Clean up text
2022-05-12 16:01:51 -07:00
Matt Bierner
5485b8e215 Include " and '/' as puctuators for slugify (#149404)
We already include `'` and `/` makes sense to treat as a puctuator too for titles such as `# do A / B`
2022-05-12 15:56:25 -07:00
Matt Bierner
9e42783398 Don't repeat markdown link validation (#149169)
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
2022-05-10 09:14:40 -07:00
Matt Bierner
d850919250 Adds cancellation to md diagnostic computer (#149122)
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)
2022-05-09 15:42:32 -07:00
Matt Bierner
a6dd083a7e Use / for md paths, even on windows (#149120)
Fixes #149010
2022-05-09 15:22:44 -07:00
Matt Bierner
04ecb1d42f Normalize markdown links in notebooks (#148827)
Fixes #146352

This ensures we pass links in markdown cells through the same normalization function we use to assign headers ids
2022-05-05 18:33:38 +00:00
Matt Bierner
c08941b87c Ignore bulkedit previews for markdown references / renames (#148744)
Makes sure we don't pick up the fake documents created by the bulkedit-preview
2022-05-04 16:03:35 -07:00
Matt Bierner
9dab79d9c8 Fix markdown web extensions (#148739)
We're currently importing a file from `test/util`, which is not supported on web. Move the noop cancellation token into the `util` folder instead
2022-05-04 14:02:38 -07:00
Matt Bierner
93fd393a0e Add API proposal for reading files in data transfer (#148596)
* Add experimental support for reading files in data transfer

Adds a new `DataTransfer.asFile` method which lets you get file objects from a `DataTransfer`. This is currently only hooked up for drop into editors.

A few follow ups:

- Right now the file data is also read eagerly when it is transfered to the extension host. Before shipping this we would make this happen lazily instead
- The drop into editor api does not provide a nice way to do anything with the dropped files.

    We should at least support returning a `WorkspaceEdit`. However `WorkspaceEdit` only supports text files, so we would also need to add an API that lets it deal with binary files

* Make `asFile` return a value instead of a promise

`asFile().data()` already returns a promise so `asFile` doesn't also need to be async

* Trying resolving data files transfer lazily

* Cleaning up code for lazy drop

* Remove testing code

* Remove unneeded buffer serialize

* 💄
2022-05-04 12:59:27 -07:00
Matt Bierner
eba8ef0547 Add diagnostics for markdown links (#148578)
* Initial work on md link diagnostics

* Adding settings to enable/disable validation

* Add delay for recomputing diagnostics

* 💄

* Split test on diagnostics compute vs management

* Validate on file open

* Remove dianostics on file close

* Allow paths to folders

* Add validation configuration option
2022-05-02 16:06:00 -07:00
Matt Bierner
e3e4bfacc3 Remove blank 2022-05-02 15:50:41 -07:00
Jean Pierre
44e644467d Enable go to definition for markdown links (#148017)
* Enable go to definition for markdown links

* Add markdown definitionProvider tests
2022-05-02 10:07:40 -07:00
Yuki Hattori
82ad6afd36 Fixes microsoft/vscode#147936 (#148503)
By changing output esbuild setting for Markdown preview scripts to iife,
prevents global namespace pollution and reduces possibility of breaking
the preview by contributions from other extensions.
2022-05-02 09:33:51 -07:00
Matt Bierner
892d6ec2a2 Fix md workspace cache for untitled files
Makes sure we also add all text documents to the list of md docs
2022-04-30 20:15:40 -04:00
Matt Bierner
8449a9f5cb Fix md rename when file does not exist
Fixes #148147

- Don't try renaming non-existent files
- Also fixes a bug where renaming in untitled files would insert `untitled:`
2022-04-30 19:52:44 -04:00
Matt Bierner
3e182633c7 Adding some more tests for markdown references 2022-04-30 19:14:03 -04:00
Matt Bierner
c41728c479 Fixes #147896 (#148101)
* Fixes #147896

* Replace all

* Fix windows slash check

* Skip test on windows for now
2022-04-26 15:45:15 -04:00
Benjamin Pasero
72b4be55fa skip markdown rename tests (#147896) 2022-04-22 08:07:49 +02:00
Matt Bierner
59b6227bf3 Use un-encoded file paths are rename placeholder 2022-04-21 22:23:53 -04:00
Matt Bierner
7b1168660a Fix resolving of links on rename
We should resolve relative to the file the rename is triggered in
2022-04-21 22:23:53 -04:00
Matt Bierner
62eebab685 Use uri instead of string 2022-04-21 22:23:52 -04:00
Matt Bierner
b438e8438d Fixing rename to use correct file paths relative to containing files 2022-04-21 22:23:52 -04:00