vscode-partial-diff icon indicating copy to clipboard operation
vscode-partial-diff copied to clipboard

Detect language mode in various cases

Open a-pav opened this issue 6 years ago • 4 comments

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.

a-pav avatar Feb 20 '19 22:02 a-pav

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.

ryu1kn avatar Feb 25 '19 02:02 ryu1kn

@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.

a-pav avatar Mar 01 '19 17:03 a-pav

Thanks @goofle for having done the quick test! 😉

ryu1kn avatar Mar 03 '19 07:03 ryu1kn

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

iliazeus avatar Jun 14 '22 10:06 iliazeus