Commit Graph

87 Commits

Author SHA1 Message Date
Matt Bierner
388d3683ea Small cleanups in markdown drop/paste (#189985)
- Observer cancellation more places
- Create constants for mime types
- Making code more consistent to show duplication
2023-08-08 16:27:21 -07:00
Meghan Kulkarni
87afa166d0 markdown link smart pasting (#188437)
* making markdown link pasting feature smarter

* update validateLink
2023-07-24 16:25:19 -07:00
Matt Bierner
7a7d45793b Allow external copying files into the workspace on markdown drop / paste (#182572)
Allow copying files in the workspace on markdown drop / paste

Fixes #157043

Also:

- Renames the markdown paste settings and makes them no longer experimental
- Makes the copyFiles setting no longer experimental
- Adds a `markdown.copyFiles.overwriteBehavior` which lets you control if/how existing files are overwritten
2023-05-15 20:17:52 -07:00
Matt Bierner
7a463ec271 Prefer reusing open tabs when opening md links in editors (#178628)
Fixes #81238
2023-03-29 15:21:31 -07:00
Matt Bierner
33867c55f3 Adopt prefix private with _ in markdown extension (#165088) 2022-10-31 14:22:39 -07:00
Matt Bierner
641046a11d Add commands to insert images/links in markdown (#163706)
* Add commands to insert images/links in markdown

Fixes #162809

* Rename commands and allow passing in uris

* Support selecting many images/files
2022-10-14 16:05:36 -07:00
Matt Bierner
d03f015931 Clean up structure of markdown extension (#161148)
- Move things related to the client under `client`
- Remove extra abstractions that are no longer used
- Add MdLanguageClient type
2022-09-19 07:16:45 +02:00
Matt Bierner
2d27f8db6a Use MD LS for resolving all document links (#160238)
* Use MD LS for resolving all document links

This switches the markdown extension to use the markdown language service when resolving the link. This lets us delete a lot of code that was duplicated between the extension and the LS

* Pick up new ls version
2022-09-07 20:55:14 -07:00
Matt Bierner
077f5865da Support latest md ls (#160228)
- Update `looksLikeMarkdownPath` to look at open documents and notebooks, not just the uri
- Register custom command  for document links
2022-09-07 07:17:41 +02:00
Matt Bierner
01ea9c11ea Update extension enabled tsconfig libs (#159631)
Matches what we set for `src/`
2022-08-31 07:57:15 +02:00
Matt Bierner
b012216211 Fix markdown images having duplicate ids (#157177)
Fixes #153144
2022-08-05 06:31:42 +02:00
Matt Bierner
32f5e49082 Move MD diagnostics to language server (#155653)
* Move MD diagnostics to language server

This switches us to using the LSP pull diagnostic model with a new version of the language service

* Bump package version

* Delete unused file
2022-07-19 16:34:09 -07:00
Matt Bierner
75e231ad82 Clean up document link resolve (#154959)
- Move vscode scheme normalization to the DocumentLinkProvider
- Remove extra function since we already recognize uri-like links
2022-07-12 15:55:21 -07:00
Matt Bierner
eeb8d49317 Move md workspace symbol search to language service (#154874)
* Move md workspace symbol search to language service

Also implements more of IWorkspace for the server

* Revert extra change
2022-07-12 10:04:25 -04:00
Matt Bierner
fc0bd9d377 Remove reliance on document.lineAt (#154191)
* Remove reliance on document.lineAt

This helps aligning more with the LSP types: https://github.com/microsoft/vscode-languageserver-node/issues/146

* Strip newline
2022-07-05 11:52:47 -07:00
Matt Bierner
e13feea6ae Only compute diagnostics for opened md files (#153395)
* Only compute diagnostics for opened md files

For #152494

* Make tests stable for result ordering
2022-06-27 15:55:38 -07:00
Matt Bierner
fc709e2d35 Use more standard values for scheme constants (#153367)
This drops the `:` from the scheme constants as it was easy to misuse this
2022-06-27 22:35:17 +02:00
Matt Bierner
da0f64881a Dispose in markdown tests (#153345)
Updates the markdown tests to dispose of disposables created during the test
2022-06-27 15:52:59 -04:00
Matt Bierner
3b549009fe Markdown path completions tests use mocked out fs (#153045)
* 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
2022-06-24 23:01:24 +00:00
Matt Bierner
00ad6bc3d4 Markdown document links should reveal cell in notebook (#153147)
Fixes #141024
2022-06-24 15:49:15 -04:00
Matt Bierner
9b7696cc9c Fix notebook links to other docs in edited markdown cells (#153052)
Fixes #148199

This makes us resolve links in notebooks relative to the notebook document instead of relaitve to the cell
2022-06-23 20:55:08 -04: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
be1ee5d9f1 Re-validate md files when a linked to file is created or deleted (#152520) 2022-06-22 19:02:46 +00:00
Matt Bierner
c84655d123 Reduce recomputation of state in markdown extension (#152804)
* 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
2022-06-21 16:25:10 -07:00
Matt Bierner
389aa8a935 Fix MdDocumentInfoCache computing values twice (#152799)
* Fix MdDocumentInfoCache computing values twice

Fixes a race where values could be computed twice before being cached

* Remove only
2022-06-21 16:22:07 -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
2249b171f4 Reduce number of times MD docs are re-tokenized (#152674)
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
2022-06-21 08:43:01 +02:00
Matt Bierner
0bc3109761 Don't try parsing non-markdown files (#152661)
This fixes our references and rename provider to not try parsing non-markdown files as if they were markdown
2022-06-20 10:44:50 -07: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
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
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
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
27759c6e03 Use limiter instead of custom batcher 2022-04-06 14:16:06 -07:00
Matt Bierner
d441406b1e Include invalid references as targets for find all references
For #146277
2022-03-30 14:36:03 -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
0c3a241171 💄 2022-03-29 18:19:50 -07:00
Matt Bierner
d49fc3ca8d Move files to better folders and add better name 2022-03-29 13:25:38 -07:00
Matt Bierner
c8c6224c84 Remove unused hash functions 2022-03-29 13:25:37 -07:00
Matt Bierner
307364a174 Check the static line cache for markdown custom editors
Fixes #138161
2022-03-17 16:06:07 -07:00
Matt Bierner
79d381f1df Use vscode-uri instead of node's path
This makes sure we handle other types of uris instead of assuming they are all file uris
2022-03-08 15:48:13 -08:00
Johannes Rieken
4a130c40ed enable @typescript-eslint/member-delimiter-style, https://github.com/microsoft/vscode/issues/140391 2022-02-02 14:35:33 +01:00
Matt Bierner
90b50dc7e2 Use ?. in a few more places 2022-02-01 13:59:12 -08:00
Matt Bierner
a2d7dfaf35 Simplify toc structure 2022-01-19 14:41:38 -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
b7c340f119 Simplify import path 2021-10-14 09:32:35 -07:00
Matt Bierner
c986aef642 Remove .only and fix fragment used when opening file
Keeping the fragment causes a duplicated file to be opened
2021-10-13 19:33:56 -07:00
Matt Bierner
830987eac3 Refactor document link opening
- Extract out of command
- Try to preserve uri instead of converting to path
- Better handle case with absolute file path when there is no workspace
2021-10-13 19:27:35 -07:00
Matt Bierner
134c345351 Try adding browser specific tsconfig
Trying to add this to catch dependencies we take on node types
2021-07-22 17:00:17 -07:00