Commit Graph

1628 Commits

Author SHA1 Message Date
Matt Bierner 569d6942e8 Use clearer reference 2025-02-07 00:31:33 -08:00
Matt Bierner ae77c3ff42 Optimistically show paste with imports if TS server takes to long when computing imports to add
Fixes #235959

When pasting across files, sometimes users can see a spinner while we wait to see if TS has a `paste with imports` edit. This needs to be done even if we insert plain text by default so that we can then show the paste widget and user can select `paste with imports`

This change makes it so that if TS takes over 200ms, we assume that a paste operation may be available and return an unresolved edit for it. Only when the edit then actually needs to be applied, we wait for TS to respond

In most cases we won't need to wait because plain text will be pasted by default. Users will then only see the spinner after selecting `paste with imports`
2025-02-07 00:01:46 -08:00
henry 3eb1f2c914 correct conditions 2025-01-24 00:41:28 -06:00
henry ac7533df77 fixed lazy client 2025-01-23 20:10:05 -06:00
Martin Aeschlimann 37a00332c7 remove old MappedEditsProvider 2025-01-15 21:21:58 +01:00
Matt Bierner 4daea74ba9 Finalize paste api and drop api tweaks
Fixes #30066

This finalizes the documentPaste api. This api allows extensions to attach metadata on text copy and change how content is pasted. Some examples:

- Updating imports for pasted code
- Inserting an image as an attachment in notebooks
- Pasting files converts them to relative text paths
2025-01-07 14:57:16 -08:00
Matt Bierner 6be3f02482 Inline simple methods
These don't add much
2024-12-16 15:50:05 -08:00
Matt Bierner bee3e32d01 Merge pull request #235987 from mjbvz/narrow-bobcat
Make sure we sync file config before generating paste edits
2024-12-12 09:56:39 -08:00
Matt Bierner 8c7ca99740 Make sure we sync file config before generating paste edits
This could explain why we occasionally see the wrong style of import being generated
2024-12-12 09:36:15 -08:00
Matt Bierner 6a0fcdeca6 Make preparePasteEdits interrupt diagnostics too
For #235959

Already done for the main paste request but we should do it for `preparePasteEdits`  too
2024-12-12 09:17:26 -08:00
Riley Bruins 3b7e1c668a Render JSDoc examples as typescript code (#234143)
Currently `@example` produces Markdown code blocks for code examples,
but they are not annotated with a programming language. This commit
annotates those code blocks as `typescript`, allowing for better
highlighting for JS/TS when using Markdown renderers that recognize
these languages.
2024-11-22 12:11:59 -08:00
Matt Bierner c83b443da0 Clean up support for paste edits (#234240)
- Allow setting an array of preferences for paste as keybindings
- Clarifies kinds used for core and extensions
- Exports text kind as API
2024-11-20 07:14:10 +01:00
Dirk Bäumer 46afc4d3b9 Handle TypeScript server arguments (#234139)
* Handle TypeScript server arguments

* Pass token as last parameter
2024-11-19 15:03:02 -08:00
Matt Bierner 4cdfe236ce Use uris when resolving project loading indicator display (#233859)
Fixes #230009
2024-11-14 18:10:33 -08:00
Nathan Shively-Sanders a1276ac6df Revert register copilotRelated with copilot (#233729)
* Revert "Add new context parameter to API"

This reverts commit a003a0de24.

* Remove additional references to CopilotRelated
2024-11-13 05:08:23 +00:00
Matt Bierner ea13242861 Extract interface and fix dispose for TS related files (#233705)
The array is updated async so we can't spread it in the return type
2024-11-12 18:01:19 +01:00
Matt Bierner ece952c3a2 Update in code default value for copy paste setting (#233361)
Update default value for copy paste setting
2024-11-07 14:01:55 -08:00
Matt Bierner 20e2977a10 Update paste/drop preference settings (#233261)
Makes it a simple array of kinds for now. We can add the mime type variation later if needed

Also makes the paste with imports have a better hierarchy. This lets you setup a keybinding for `text.updateImports` that will work across all languages that support it
2024-11-06 22:59:18 +01:00
Matt Bierner 54d81cd618 Add paste as default settings and enable js/ts paste with imports by default (#233031)
Fixes #184871
For #30066

Adds new settings that let you configure the default way to paste/drop.

Also enables js/ts paste with imports by default for 5.7+. However will not apply by default. Instead it will be shown as an option after pasting. You can then use the `editor.pasteAs.preferences` setting to make it apply automatically or use the `javascript.updateImportsOnPaste.enabled` settings to disable the feature entirely
2024-11-04 16:30:09 -08:00
Matt Bierner 931da88532 Fix conditional (#232742) 2024-10-31 09:56:55 -07:00
Isabel Duan 20a02666f9 Merge branch 'main' into organizeImportsSettingsFix 2024-10-30 15:50:10 -07:00
Isabel Duan 95779b7b37 add descriptions, refactor getPreferences function to be more clear 2024-10-30 15:28:59 -07:00
Matt Bierner d83223b7c2 Try allowing custom commands to be sent to tsserver by extensions (#232663)
For #218275

Limit this to commands that start with `_` which should indicate that it's a private command and prevent clashes with normal TS commands
2024-10-30 14:20:30 -07:00
Matt Bierner c74816239d Pick up TS 5.7 insiders for builtin ts version (#232650) 2024-10-30 12:09:20 -07:00
Matt Bierner 4679606b30 Don't try watching non writable file systems (#232433)
For ts and markdown, skip watching on file systems that are not writable as these files should not change
2024-10-28 11:12:01 -07:00
Matt Bierner 86aab25210 Redirect TS report issue to issue reporting guide (#231527)
Almost none of the issues that come in through our `report issue` button are actionable. Previously more people were filling in the template and following up, but now very few do

So instead, I'm changing this to open a guide about the common causes of crashes and how to file a good issue report. This guide also focuses on helping people self-diagnose and fix problems
2024-10-16 14:17:04 -07:00
Matt Bierner e2e048ded8 Merge pull request #230345 from microsoft/dev/eslint-9
Eslint 9 migration
2024-10-07 09:15:12 -07:00
Nathan Shively-Sanders a003a0de24 Add new context parameter to API 2024-10-07 07:24:34 -07:00
Nathan Shively-Sanders a1cd9f37f1 Update copilotRelated API with Disposable/CancellationToken 2024-10-07 07:24:34 -07:00
Nathan Shively-Sanders 007126775c add missing ts-expect-error till 5.7 2024-10-07 07:24:34 -07:00
Nathan Shively-Sanders 50a1fbda47 Register copilotRelated, use selector's languages
The select provided at registration contains the correct list of
languages to register for the provider.
2024-10-07 07:24:34 -07:00
Nathan Shively-Sanders fc7db1c7da Remove stray edit 2024-10-07 07:24:34 -07:00
Nathan Shively-Sanders bada583519 ts-expect-error on upcoming TS 5.7 protocol 2024-10-07 07:24:34 -07:00
Nathan Shively-Sanders b8e8e701f5 Depend on TS 5.7 not 5.6 2024-10-07 07:24:34 -07:00
Nathan Shively-Sanders e169ac792f Move copilot related-files to language features
It is now in its own file.

Also address other PR comments.
2024-10-07 07:24:34 -07:00
Nathan Shively-Sanders 7e5592d88e Update to new command name 2024-10-07 07:24:34 -07:00
Nathan Shively-Sanders 7fcf402604 TS extension: add related-files call to CopilotRelated
registerRelatedFilesProvider is a new method on the copilot extension.
CopilotRelated is a new tsserver command that provides information from
tsserver to copilot. (The information is not necessarily
copilot-specific, of course.)
2024-10-07 07:24:34 -07:00
Matt Bierner f22a1167e4 More fixes 2024-10-02 17:22:33 -07:00
Matt Bierner d3596df9eb More type assertion fixes (#230181)
For #211878

Also adds a few suppressions
2024-09-30 16:21:12 -07:00
Matt Bierner 5ddd3d2cc1 Only enable js/ts paste with imports for copy and pasted within VS Code (#230167) 2024-09-30 22:56:30 +02:00
Matt Bierner f4bdaadbac Merge vscode ts file watch settings (#230152)
Fixes #230144

Also deprecates the experimental setting while still observing it for now
2024-09-30 12:32:24 -07:00
Matt Bierner f74d65ef2c Adopt preparePasteEdits for js/ts update imports on paste (#230007)
Client side of https://github.com/microsoft/TypeScript/pull/60053
2024-09-27 21:50:23 +02:00
Gabriela Araujo Britto 0f9abf3c35 [typescript-language-features] Expandable hover (#228255)
* add verbosity level to hover provider

* cleanup

* update minimum ts version

* get `canIncreaseVerbosityLevel` from server response

* add expandable hover experimental setting
2024-09-24 09:22:09 -07:00
Matt Bierner 4840eb096d Enable semantic features for untitled files on web (#229426)
Fixes #229424

Also removes an old scheme that is no longer used
2024-09-23 11:55:37 -07:00
Daniel Rosenwasser 75c0fc210a Provide project/file name in TypeScript loading indicator (#225643)
* Specify which project is loading at any given time. Provide an indicator for file opens.

* Just use `vscode.workspace.asRelativePath`.

* Remove unused import.
2024-09-18 10:56:50 -07:00
Benjamin Pasero b218243b76 ts - detect more patterns of disabled node_modules watching 2024-09-18 10:07:16 +02:00
Benjamin Pasero 1fb9bc85a4 ts - refine log when canUseWatchEvents is not used 2024-09-18 10:07:16 +02:00
Benjamin Pasero e36b6d7d54 ts - log when canUseWatchEvents is not used 2024-09-18 10:07:16 +02:00
Benjamin Pasero 88b706b2bb watcher - support suspend/resume for non-correlated requests (#228703) 2024-09-16 12:24:34 +02:00
Matt Bierner 94d5b2a31e Remove ts-expect-error 2024-09-11 14:49:06 -07:00