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

require('folder') breaks hinting #32

Open
hacker112 opened this issue Oct 7, 2014 · 4 comments
Open

require('folder') breaks hinting #32

hacker112 opened this issue Oct 7, 2014 · 4 comments

Comments

@hacker112
Copy link
Contributor

Ternific does not handle require('folder') correctly. Hinting stops working when there is code that uses require('folder') in a javascript filer.

require('folder') is equivalent to require('folder/index.js').
require('folder/index.js') gives hints but not, require('folder').

@MiguelCastillo
Copy link
Owner

@hacker112 doing require('folder') is more of common js (node require) nomenclature. I am not sure I can safely integrate cjs (node) and also handle amd (requirejs) where that stuff in configured.

Is this actual live (deployed) code or just something you found while testing?

@hacker112
Copy link
Contributor Author

This is node require I am talking about. I see your point, but I think that checking if require is global or a local variable would be sufficient enough, but I am not 100% sure.

This is in my project code, so I could also of course change my code instead. I did thought of any collision with requireJS.

@MiguelCastillo
Copy link
Owner

@hacker112 Checking if require is global works well and probably one thing of many things application developers should take in consideration (UMD)... But Ternific is running inside of Brackets, which uses requirejs. So checking if require is in the global will always result in a true check :)

The check will probably have to be more on the configuration for ternific that if it has defined node support, than I could enable such assumptions about folder/index.js. Let me think through how that could work

@MCTaylor17
Copy link

Could you test the relative path using the file system stat method to see if it exists and if it's a file or directory?

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

3 participants