vscode: Incorrect language detection leads to annoying recommendation

Testing #143576

Typing out manually

class Foo {
	private foo: Foo
	constructor() {
		this.foo = ''
	}
}
image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

The model now has some better confidence heuristics built in.

Related to this, I also get C++ guessed if I open a new untitled file and type:

<

yes just one character. I was attempting to type <html which does guess correctly, but I feel like those first few characters that guess C++ is a little much.

For my issue, maybe we wait for like 5 characters at least?

If this is a new user doing their homework, they are going to need to save this file to run it

About ~1 yr ago, @isidorn added a “save on run” feature. The intent (my understanding) is that this was added because a lot of new users were “running” untitled files without saving them to an actual concrete file and extensions were having to handle this case (and some weren’t causing confusion to the user). This was mostly the case because new users weren’t quite grasping that an untitled file wasn’t a real file on disk.

Maybe @isidorn has some thoughts on this

Added a minimum amount of text used when guessing which might help here. Getting a confidence score out of the model is a better fix.

I wonder if we should revisit how we prompt for ext recommendations in untitled files. A "This Looks Like C++, Would you like to install relevant extensions? Yes / No / Not C++ " would be good for analysis of model performance as well.