Commit Graph

40 Commits

Author SHA1 Message Date
Matt Bierner
8acfd0ae60 Exclude empty links from md results (#153161)
These are technically valid links but we don't care about them since they take up no space
2022-06-24 21:42:00 +00:00
Matt Bierner
ab7bc9fb0b Split up MD link tests (#153048)
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
2022-06-23 17:53:56 -07:00
Matt Bierner
385bf5036b Optimize NoLinkRanges lookup (#153010)
This switches us to use a map to check if a position exists inside the no link ranges
2022-06-23 11:38:13 -07:00
Matt Bierner
07144d22c4 Rename types in the markdown extension (#152905)
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`
2022-06-22 14:12:48 -07:00
Matt Bierner
d5a75f2ceb Add logging for MD language features (#152792)
This verbose logging will help track down inefficient calling patterns (such as recomputing stuff)
2022-06-21 14:18:36 -07:00
Matt Bierner
fa53aa6fec Cleanup pass for md extension (#152760)
Clean up names in md extension
2022-06-21 15:36:32 -04:00
Matt Bierner
5a175207de Improve markdown link regexp (#152533)
* Improve markdown link regexp

This makes the markdown link regexp more readable and also combines the two regular expressions we were running

* Fixed backtracking
2022-06-19 06:25:54 +02:00
Matt Bierner
623f55f437 Refactor markdown language features (#152402)
(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
2022-06-17 10:25:52 +02:00
Matt Bierner
00273730e8 Split markdown linkComputer from linkProvider (#152124)
Instead of passing around a full `vscode.DocumentLinkProvider`, we should pass just the more minimal interface that consumers need
2022-06-14 15:34:05 -07:00
Babak K. Shandiz
a8de8e2112 [markdown] Ignore brackets inside link text (#151610)
* 🔨 Allow texts in bracket pairs inside link titles; [text](link)

Signed-off-by: GitHub <noreply@github.com>

* 🔨 Allow texts in bracket pairs inside link titles; [text](<link>)

Signed-off-by: GitHub <noreply@github.com>

* ⚗️ Add tests to verify  link titles can include bracket pairs

Signed-off-by: GitHub <noreply@github.com>
2022-06-09 11:48:50 -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
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
e6fff5ecff Don't parse checkboxes are links in markdown (#150914)
Fixes #150672
2022-05-31 14:57:32 -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
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
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
Akat
b499467f9f fix(markdown): avoid considering link references/sources in code sections (#146826) 2022-04-07 14:50:37 -07:00
Matt Bierner
a56c9f10b7 Enable find all references and rename of auto links and http(s) links in markdown
For #146777, #146277
2022-04-05 15:18:18 -07:00
Matt Bierner
0e65adbda8 Initial work on rename in markdown
For #146291

Also fixes references triggered on a definition link
2022-03-31 15:11:34 -07:00
Matt Bierner
8adb42079b Fix slow positionAt impl for markdown references
- Use `vscode-languageserver-textdocument` instead of custom impl
- Reuse `InMemoryDocument`  across tests and working code
- Use `SkinnyTextDocument` in more places
- Fixes some test errors that seem to be caused by bad `InMemoryDocument` impl
2022-03-29 18:19:52 -07:00
Matt Bierner
22fb4e9de8 Better align language provider names and export styles
- Use named exports
- use `Md*` for providers
2022-03-29 13:35:48 -07:00
Matt Bierner
7736c87cb0 Move markdown preview files to own folder 2022-03-29 13:25:35 -07:00
Matt Bierner
d2db6fb2d0 Remove negative lookbehind in regexp
Fixes #145655
2022-03-22 14:34:46 -07:00
BamBamboozled
b6f6a37cbd Add support for references when no [] exists (#144781)
* add single reference linking regex

* add less invasive regex

* add lookahead to exclude [tag]: <url> case

* add tests for references when no [] exists

* revert integration test script

* make test description clearer

* remove vim swap file (whoops)

Co-authored-by: Jayce <grate.resales.0r@icloud.com>
Co-authored-by: Jefferson Chen <jc@Jeffersons-MBP.attlocal.net>
2022-03-17 12:55:31 -07:00
Johannes Rieken
7ccb868835 make sure to use .eslintignore when running yarn eslint, this will ensure that cli failure and editor squiggles are always equal 2022-02-02 12:37:29 +01:00
Waqas Ali
a514979b02 Prevent link highlight in markdown code blocks and spans (#140816)
* Prevent link highlight in markdown codeblocks (#139770)

* Handle inline codespan variants for markdown link provider (#139770)

* Refactor codespan detection in markdown link provider (#139770)
2022-01-25 12:38:50 -08:00
Matt Bierner
a4e529c759 Add basic markdown link completions
For #140602

Only normal links for now. Will add reference links later. Should support the forms:

- `[](dir/file.md)`
- `[](./dir/file.md)`
- `[](/root-dir/file.md)`
- `[](#header)`
- `[](./dir/file.md#header)`
2022-01-12 18:13:21 -08:00
Matt Bierner
a9bc0553f7 Support definition links with spaces
For #136073
2021-11-01 09:23:03 -07:00
Nafana
df59ceb026 Markdown reference links starting with ^ should not be clickable (#108015)
Co-authored-by: mmacovei <mmacovei@sfu.ca>
2020-10-08 00:38:17 -06:00
Matt Bierner
362d345448 Adding tests for opening markdown document links 2020-07-10 13:25:55 -07:00
Micah Smith
01f7276b7e Fix for issue #35245 2019-06-12 14:30:54 -04:00
Phil Marshall
a7c88d79a2 updated test for switched order and new tests for image link 2019-01-25 18:46:28 -06:00
Phil Marshall
b1de159292 added test for markdown image link underline 2019-01-22 18:46:55 -06:00
Johannes Rieken
c8ac8ec300 debt - towards scheme-enforcement, #56108 2018-08-10 12:10:30 +02:00
Matt Bierner
7980812a43 Properly handle links with title 2018-05-04 11:37:32 -07:00
Matt Bierner
43ed87ccde Add test for #49011 2018-05-04 11:37:32 -07:00
Matt Bierner
bd29afad2c More pinning tests for markdown links 2018-05-04 11:37:32 -07:00
Matt Bierner
c068e6fdfe Start adding some basic document link pinning tests 2018-05-04 11:37:32 -07:00