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
Implement basic code completion #1189
Conversation
HOLY SHIT THIS IS ACTUALLY HAPPENING.
|
Is it hard to implement fuzzy filtering ? But this is a very good start 👍 |
👍 this is like every Christmas and birthday since the dawn of time occurring simultaneously. |
@@ -928,6 +928,39 @@ var EditSession = function(text, mode) { | |||
|
|||
_self.$modes[mode] = new module.Mode(); | |||
_self.$modes[mode].$id = mode; | |||
|
|||
// this is for autocompletion to pick up regexp'ed keywords |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this must go somewhere else, edit session is already too big
Fixed ace based popup, but not sure if keeping it is a good idea, would be good to find a nice listView with virtual viewport to use instead of it. |
So, is this getting merged in? Agree with @faceleg. Although, I'd add that this is also like having the Easter Bunny choose you alone to receive all chocolate. FOR LIFE. |
+1, would love to see this merged in. |
Another vote to see this merged in, in whatever form is best for Ace's architecture. I've put in a pull request to integrate changes that would allow this branch to pass the tests. #1247 The issue was that Worker exists only when running in a browser. edit_session.js just avoids starting a worker if typeof Worker is undefined or if require.noWorker is true. I've just reused these conditions. |
@lddubeau I'm going to merge master in and tweak it around a little. I thank you for your patch, but based on @nightwing's comments earlier I think I should drop the worker execution. |
@MarkMurphy I see the exact same error as well! |
My attempt at fixing the |
I just played around with the feature and it looks great. In addition with the code-snippet feature that has just been merge, it's a killer! |
Hi - Do we have an ETA on when this might me merged to master? Thanks. |
Does this need more testing? Code tweaks? What's preventing this making it in? |
Conflicts: lib/ace/edit_session.js
+1! |
@gjtorikian @nightwing Alright. Really nice work guys. This looks good enough to go in. |
Implement basic code completion
|
Added it in d2f7247 |
👍 Is there any way to code complete automatically rather than with a key binding? |
not yet, since that's not very useful with general word based completion in simplest form it can be something like editor.commands.on("afterExec", function(e) {
if (e.command.name == "insertstring") {
if (e.args == "<" || e.args == "." )
e.editor.execCommand("startAutocomplete")
}
}) |
Is there a way I can define what all is in scope for the currently edited file so that code completion works not only for the symbols defined in the current source, but maybe in a library that I want to include? |
For #110.
Features include:
Ctrl-Space|Shift-Space|Alt-Space
createKeywordMapper
I can think of a few improvements: enable autocompletion by default (without keybinding, based on a preference), and better integration of Mode highlighting rules into the autocompletion list, emmet support--but this is good enough for now.
Seems to work well on a file of 100k LOC (Ace unminified + jQuery unminified + APF unminified).
I made a few required changes to lib/ace/worker/mirror.js. The first is the ability to attach arbitrary additional data to the worker (beyond just the document value). The second is that currently, wokers fire on every doc change. I wanted the worker to only fire once, and then end itself. so I added the option to turn off
deferredUpdate
.Current Issues
Given these please let me know if a WIP PR is not appropriate and I'll close this and move the discussion back to the issues.