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

Language Auto-detection #37

Open
cdelahousse opened this issue Feb 5, 2013 · 4 comments
Open

Language Auto-detection #37

cdelahousse opened this issue Feb 5, 2013 · 4 comments

Comments

@cdelahousse
Copy link
Member

Imported issue by spratt from 2012-07-04T12:27:25Z
Originally opened as SteamedPears/CodeReviewClientMaster#18


As the user enters code in the code submission window, we should make a reasonable guess at which language they are using, but still let the user pick their language, and stop trying to auto-detect once they've chosen.

@cdelahousse
Copy link
Member Author

Imported comment by Gankro from 2012-07-14T23:16:56Z *


This doesn't seem tractable, as indicated by the ubiquity of "C-Like". Also if you have a string with another language in it, how would you possibly resolve that? Is this some HTML with javascript, or some javascript with HTML?

@cdelahousse
Copy link
Member Author

Imported comment by spratt from 2012-07-15T01:49:49Z *


Our first idea is a Bayesian classifier. Basically build a score for each language, maybe based on the number of keywords matched, and calculate the probability of each language. When the probability passes a certain threshold, make that guess.

@bheesham
Copy link
Member

bheesham commented Feb 6, 2013

Don't really want to implement this, unless ACE has the power to do it. I don't think as a reviewing app, we would have to worry about the language, so much as the reviewing part. I would like the ability to change the syntax highlighting though.

So, lets say that someone incorrectly uploads something as Python, but then someone see's and decides to change it to CofeeScript, because the syntax of both confused them.

I think it would be wise to not really enforce one highlighting option. How much resources are we going to use up showing a select box, to re-highlight code? Most of the work would be on the client side, and ACE is pretty fast at that stuff.

@psimonyi
Copy link
Contributor

psimonyi commented Feb 6, 2013

On Tue, 2013-02-05 at 19:03 -0800, Bheesham Persaud wrote:

I don't think as a reviewing app, we would have to worry about the
language, so much as the reviewing part.
Well, code readability is a key part of giving a good review.

Having the option to override the poster's highlighting choice seems
like a good idea, but good defaults are the hallmark of a good app.
Also, this problem has been solved elsewhere, e.g. in vim. We should
just look to see who else does language detection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants