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

Code hints: Support require() calls not in an AMD wrapper #12280

Open
core-ai-bot opened this issue Aug 31, 2021 · 8 comments
Open

Code hints: Support require() calls not in an AMD wrapper #12280

core-ai-bot opened this issue Aug 31, 2021 · 8 comments

Comments

@core-ai-bot
Copy link
Member

Issue by ericelliott
Monday May 13, 2013 at 18:29 GMT
Originally opened as adobe/brackets#3801


Using Build 24

Command-E for inline edit sometimes works, but it's very slow. Usually, it just doesn't work at all.

Opening the developer tools doesn't give me any errors. Just a couple warnings about assigning unrelated hotkeys.

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Tuesday May 14, 2013 at 01:11 GMT


@dilvie Is the file containing the definition of the function located within your project tree? Or is it elsewhere?

If it's within the project tree, Brackets should find it. Can you give an example of (a) the code your put your cursor on, and (b) the code for a function definition you expected it to find?

@core-ai-bot
Copy link
Member Author

Comment by pthiess
Tuesday May 14, 2013 at 18:32 GMT


Reviewed@peterflynn - need more information to decide on the priority.

@core-ai-bot
Copy link
Member Author

Comment by ericelliott
Tuesday May 14, 2013 at 19:10 GMT


It is in the same project tree.

I see this issue intermittently for all functions which have been require()'d from another Node module. I have yet to find one that consistently works.

I have not tried AMD modules, so I don't know about that.

file1.js

module.exports = function () { return 'foo'; };

file2.js

var foo = require('./file1.js');
foo();

Place the cursor on foo(); in file2 and hit Command+E.

Result:

Nothing happens -- OR -- inline edit works very slowly. I have not been able to figure out if there's a deterministic repro case.

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Wednesday Jul 10, 2013 at 00:33 GMT


@eztierney, any idea about this one? I know we don't grok Node-style require()s (per #3938, Tern's plugin for it isn't used), but I thought we still scan all sibling files regardless.

I can repro this even with a less exotic structure such as:

moduleA.js:

function bar() {
    return 'foo';
}
exports.bar = bar;

main.js: (in same folder)

var foo = require('moduleA.js');
foo.bar();

Even there, Jump to Definition on "bar" doesn't do anything, and Quick Edit falls back to simple string search...

@core-ai-bot
Copy link
Member Author

Comment by eztierney
Wednesday Jul 10, 2013 at 14:21 GMT


@peterflynn We do scan all sibling files, but the problem is that we don't understand the call to require.

The requirejs plugin only understands the synchronous call to require when it's inside a simplified CommonJS wrapper. The node plugin referenced in issue #3938 understands that synchronous require calls could be anywhere, which is one reason why we want to turn that on for node files.

@core-ai-bot
Copy link
Member Author

Comment by ericelliott
Monday Sep 30, 2013 at 16:40 GMT


Any progress on this issue?

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Tuesday Mar 18, 2014 at 01:51 GMT


Marking needs review -- closely related to #3938. Whether we move them to the backlog or what, both should probably have the same resolution.

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Tuesday Mar 18, 2014 at 01:53 GMT


Clarifying title (was: "Inline Edit Broken for Node Projects")

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

No branches or pull requests

1 participant