ryu1kn / vscode-partial-diff

Visual Studio Code Extension. Take a diff of 2 parts of text(s)
https://marketplace.visualstudio.com/items?itemName=ryu1kn.partial-diff
MIT License
184 stars 15 forks source link

Detect language mode in various cases #38

Open a-pav opened 5 years ago

a-pav commented 5 years ago

Hi,

It would be good if Partial Diff could detect and select (or suggest) language mode for me (user). For example when I copy a piece of code from a .go file (first selection) and another piece from another .go file (second selection) what could be the preferred language mode for me except Go?

I think this extension can make the decision, or I'm wrong. Whatever, just an idea.

ryu1kn commented 5 years ago

Hi @goofle thanks for the suggestion.

I wonder if you get red squiggles if the comparing part is non-well-formed code block. Let's say you have the following code block

function foo() {
  return "bar";
}

and compare only the part of above code like below

unction foo() {
  return "bar

then you may get the weird syntax highlighting with red squiggles. I haven't tested it myself.

a-pav commented 5 years ago

@ryu1kn I did a trivial test and this didn't happen. No weird syntax highlighting and no squiggles. BTW, I think it's the user's responsibility to compare only valid pieces of code, if that's what you're concerned about.

ryu1kn commented 5 years ago

Thanks @goofle for having done the quick test! 😉

iliazeus commented 2 years ago

@ryu1kn I think I found a simple fix in #81.