Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not paste URL as formatted when pasting inside a word #186289

Closed
isidorn opened this issue Jun 27, 2023 · 3 comments
Closed

Do not paste URL as formatted when pasting inside a word #186289

isidorn opened this issue Jun 27, 2023 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug markdown Markdown support issues verified Verification succeeded

Comments

@isidorn
Copy link
Contributor

isidorn commented Jun 27, 2023

Testing #186236

Imagine that I am a user that is unaware of the cool new feature that we have. I just wrote the following
[Microsoft](*), and the cursor is at the * location and I now want to paste https://microsoft.com. What I will get is
[Microsoft]([Title](https://www.microsoft.com/))

Can we be a bit smarter to handle this case? Some heuristics we could potentially apply:

  • Do not format URL on paste if you are in the middle of a word
  • Do not format URL if you are inside a link
@mjbvz
Copy link
Collaborator

mjbvz commented Jun 27, 2023

@MeghanKulkarni It's likely too late to try working on this in the current iteration, but consider how you might do so in the future and how you would make sure the feature is future proofed

In this case, in the future we may be able to make this feature smarter but some users may still want the existing behavior where pasting a link always (and predictably) inserts a link

One idea would to use an enum value for markdown.editor.pasteUrlAsFormattedLink.enabled with values such as:

  • always — The current default
  • smart — A new value to be added in the future. This would try to intelligently infer when a link should be created
  • never — Turn off the feature (same as false today)

For now we'd only ship with the always and never enum values. Then next iteration you can work on implementing smart (and potentially make it the new default too)

@isidorn
Copy link
Contributor Author

isidorn commented Jun 28, 2023

I like that idea Matt. +1 on making smart the default once we are happy with it.

@mjbvz
Copy link
Collaborator

mjbvz commented Jan 8, 2024

I believe this has been fixed/implemented. With smart, we now only paste as a link if you have a selection and are not already inside something that looks like a markdown link

@mjbvz mjbvz closed this as completed Jan 8, 2024
@mjbvz mjbvz modified the milestones: Backlog, December / January 2024 Jan 8, 2024
@isidorn isidorn added the verified Verification succeeded label Jan 25, 2024
@aiday-mar aiday-mar added this to the December / January 2024 milestone Feb 6, 2024
@microsoft microsoft locked and limited conversation to collaborators Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug markdown Markdown support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants