codewars / codewars.com

Issue tracker for Codewars
https://www.codewars.com
BSD 2-Clause "Simplified" License
2.1k stars 220 forks source link

Please add autocompletion for all programming languages #1870

Open javatlacati opened 5 years ago

javatlacati commented 5 years ago

Is your feature request related to a problem? Please describe.

It's not a problem, but it could be helpful.

Describe the solution you'd like

Perhaps the classic Ctrl + Spce or Command + Space to get reserved word and method autocompletion.

Describe alternatives you've considered

None yet.

Additional context

Some other programming sites have the code autocompletion feature, it would be helpful to evalute if people can solve problems instead of remembering the whole syntax by heart.

┆Issue is synchronized with this Clickup by Unito

Steffan153 commented 5 years ago

CW uses CodeMirror. I don't think it has autocompletion for every language, but it has some: https://codemirror.net/doc/manual.html#addon_show-hint

Voileexperiments commented 5 years ago

Your suggestion is confusing since you're mixing up two things: reserved word and method autocompletion consists of syntax autocomplete and code autocomplete, which requires two different sophistications of coding tools; meanwhile, CodeMirror is a text editor, not an IDE, so while it can handle the former (see Jupyter notebook) it's the wrong tool for the latter. If you want actual, real, scientific code autocomplete you'll need at least something like a web version of VSCode.

Steffan153 commented 5 years ago

I was saying that CodeMirror has some built-in auto-completion. But, if you want something like VSCode then you're looking for Monaco: https://microsoft.github.io/monaco-editor/

That's actually better if you want auto-completion for most languages, but you still might not get it for every single language.

Steffan153 commented 5 years ago

reserved word and method autocompletion.

Ah, yes, that is a bit confusing. But, auto-completion from VSCode was what I was thinking of.

javatlacati commented 5 years ago

go to hacker rank and you'll se what is the state of the art for the copetition

Voileexperiments commented 5 years ago

Yes, and they use Monaco, which is also VSCode's editor. So your suggestion should've been something like "HackerRank uses Monaco which has intellisense, can we use that on CW so we have intellisense too?" then perhaps something can actually be discussed about. There are lots of problems with this though:

Basically, if you're claiming HackerRank's usage of Monaco is a good indicator of what a better code editor can be, that sounds like you haven't actually used them there since intellisense doesn't work at all for like 80% of the use cases (JS, C#, Java, Ruby, and most of Python). And if you remove the intellisense, then it's almost identical to a text editor with basic auto-complete (like notepad++), which is like 95% the same as the current CW editor besides a very tiny amount of QoL improvements, so there's nothing amiss.

kazk commented 5 years ago

@javatlacati I have some questions. Have you actually written code on their editor? Did the completion actually help? Did the completion happen based on context or simply alphabetical? Have you tried languages other than JavaScript and TypeScript? Most languages will need the LSP backend in order to work like @Voileexperiments wrote above. JavaScript and TypeScript kind of works but it's not really intelligent because it's not actually using LSP if I remember correctly.

It's not difficult to add completion that's not intelligent. For example, suggesting from known set of words. This can be useful if you want to complete from known set of things: https://github.com/Codewars/codemirror-agda does this.

We've actually done a lot of research on this topic for Qualified and using the LSP is the way to go. CodeMirror can become a Language Server client using an adapter that's work in progress (demo). I think this will only work for the file itself and anything builtin.

The main obstacle is that LSP requires the server and the client to share the physical filesystem so that it can read and analyze files on demand. There's xfiles extension to LSP by SourceGraph that avoids this, but that's not in the standards so it's not supported by all servers. Even if it was in the standards, the client needs to provide files requested by the server and we can't do that for Codewars because it's not available there.

Just to be clear, switching to Monaco won't resolve this.

I doubt improvements, if any, by simple completion will be worth the cost and it might be even annoying to see irrelevant suggestions. We can keep the issue open for now.

javatlacati commented 5 years ago

@Voileexperiments I'm claiming that recruiters prefer hackerrank and they think their editor is a competitive leverage, so if it's that easy as you said to get something better in place I'd like to see it

kazk commented 5 years ago

@javatlacati can you answer my questions? I don't think they have "intelligent" completion, but I haven't used them extensively.

Also, I think you're misunderstanding what @Voileexperiments and I wrote above. It's not easy to add intelligent completion. It's relatively easy to fake it and claim we have autocompletion, but that's not helpful for the users. So if you just want "reserved word" completion ignoring the context, that's possible but I don't think it's worth it.


If you're talking about their product sold to companies, a service with Web IDE that lives in a container created per candidate, then I think they do support full LSP. They can do that because they prepare the environment for each candidate and the editor is launched in there, having full access to the files. This gets very expensive so I don't think they do that for regular code challenges.

Codewars doesn't compete with them in this aspect. On Qualified, we do have a comparable product (having features theirs lacks and vice versa) and working on a tool to sync local files to the challenge so you can use your own IDE instead.

Steffan153 commented 5 years ago

You can get autocompletion for JS with CodeMirror's plugin (and get more with third-party ones) :smiley: I see that monaco probably won't work that good, but CodeMirror should work alright.

Often I use my own IDE anyways though since the built-in editor is a bit slower, and I like autocompletion and syntax highlighting in VSCode.

Anyways, I don't need auto-completion in CW tho.

javatlacati commented 2 years ago

For the code I've written in the editor I can tell you that they don't have intelligent completion since for that you will have to define intelligence. What Hacker Rank has is a competitive code copletion and for that codewars can't compete against.

praxder commented 1 year ago

Any updates on this? As someone new to this site, but experienced with software development in an IDE, no auto-complete is a compelling reason for me to explore other sites. It's simply painful to code without autocomplete.

kazk commented 1 year ago

I implemented this for Qualified, but it's not coming to Codewars anytime soon. Languages with Language Server can be supported. I'm hoping we can enable it on Codewars in the future, but we don't have any plans yet.


Reposting https://github.com/codewars/codewars.com/issues/2483#issuecomment-1140193150

We know it's nice to have, and we'd love to support it, but it's not cheap. Like I wrote above, we might introduce autocompletion as a paid feature.

It's a basic feature that almost every platform supports

I disagree. It's definitely not a basic feature when you need remote Language Servers. I also disagree about almost every platform supporting it. It's probably more limited than you think. Incomplete autocompletion ignoring context is more annoying than not having any.

  • VS Code for the Web (github.dev) works entirely in browser, and has limited language support because of it. Autocompletion in many languages only show existing tokens. It's also by Microsoft, who owns VS Code.
  • TypeScript playground is only for TypeScript in the browser context.
  • Services like CodeSandbox and Replit are great, but I don't think it's fair to be compared against teams focused on providing the best in-browser coding experience.
  • HackerRank's free problem is a single main file, which is much cheaper to support. We have multiple files with more complex setup. I don't think they have more complex challenges for free.
  • LeetCode supports it as a paid feature.

I wrote some technical details in https://github.com/codewars/runner/issues/42#issuecomment-719843804 if interested.

Snipe3000 commented 1 year ago

I think HackerRank has auto complete, most people just switched over to that.