anacierdem / vscode-requirejs

Provides goto definition functionality for require js modules.
MIT License
21 stars 14 forks source link

Implement Autocompletion #43

Closed anacierdem closed 5 years ago

BrightSoul commented 6 years ago

Any progress on this? Would you make a checklist about what needs to be done so that others might help?

anacierdem commented 6 years ago

In fact, current provide definition implementation finds shortest route to the target module, and do a search for the initial symbol in that file. So we basically need a mechanism to find all the implementation from a given module.

I'll write a to do list when I have the time.

BrightSoul commented 6 years ago

Yeah, I saw it's currently using a regexp to find the implementation on the target module which is not failproof. https://github.com/anacierdem/vscode-requirejs/blob/83228a3916882bc64a636106e83eecc2edcc2499/extension.js#L223

I think it's better to parse the module source by using textmate, which is provided by Visual Studio Code. See here: https://github.com/Microsoft/vscode/issues/46281

I forked your repository, I might do some experimentation on my spare time.

anacierdem commented 6 years ago

@prantlf was once working on migrating the project to esprima. Don' know why gave up.

I have an idea;

Let's use vscode.executeCompletionItemProvider based on the found target module?

I'll work on this.

anacierdem commented 6 years ago

Not the way I've anticipated, but I've implemented a crude version.

I suggest writing some tests to cover very basic use cases for this implementation.

anacierdem commented 5 years ago

Reverted eval version as it may cause more issues than it resolves.

anacierdem commented 5 years ago

Decided to close this one as I do not need this feature and no one requested it.