Comments (8)
Do you think people are going to want to deal with a UI to set this? Is there some "project" file whose presence could be sought out to define this?
Also, the Brackets-only brackets.getModule() API in extensions is a further annoyance. It seems like a hack to handle this API name explicitly... maybe a "project" file could define places to search for modules? We could also just not support it for now.
from brackets.
Yeah, I think getModule()
is too Brackets-specific--not sure we should worry about it now (although it would be good to figure out some way we could hack it to work for our own purposes).
For configuring require paths in general, we don't currently have a preferences UI, though we do have some infrastructure for storing per-project preferences in local storage. However, I think you could argue that for this kind of thing you might really want a metadata file in the project itself. We don't yet have a mechanism/policy for this since we haven't had any features up till now that needed it, but I think we're probably going to have other features that would need that going forward, so it's worth discussing. If we do go that route, then we could just make it so you have to manually write that config file for now, and then worry about making a UI later (if ever).
from brackets.
Yeah, I wasn't thrilled with only searching from the project root. I wasn't sure if there was some sort of convention for where js source files go, and maybe we could search those as well? I've seen some open source projects put their code in 'src' or 'lib' but don't know how common that is.
Another thought I had would be to search the project for any files whose path ended with the module name. So for
var PerfUtils = require("utils/PerfUtils");
we could look for any files that ended with "utils/PerfUtils.js". We'd have to come up with some way to break ties, maybe pick the "closest" file to the file the require is in or something like that. This could eliminate the need for configuration, and may even work when users have specified different baseUrls for requirejs.
from brackets.
Would it be possible to just use the requireJs baseUrl configuration value? http://requirejs.org/docs/api.html#config-baseUrl
from brackets.
The question is how would we know what the baseUrl was set to? Remember, we just have the text of the source -- we're not running inside the user's project. We could search all files in the project for one containing baseUrl: ...
but that seems a little sketchy.
from brackets.
Right, I forgot that it just reading the files and not running them. Searching for the baseUrl might not be the best. It might not even be defined and yet not the be project source and gets defined by the location of the html file that loads require or the data-main attribute in it.
for using the path, i think it might be better to search for more paths to break a tie since you might get an unique file or several in the same folder, that could break the tie. Once the base url is found, this can be saved since it shouldn't change.
from brackets.
Yeah, baseUrl could be useful when we can determine it. But I was also trying to make things work when we don't have baseUrl, or the project root is not the web root (such as when you open the entire brackets folder, rather the the /src folder).
I was thinking that solution might also make custom baseUrls mostly work (without special baseUrl analysis), though I'm sure there are cases where the tiebreaking code could be wrong, but hopefully those cases would be rare.
from brackets.
Moved to adobe#3560
from brackets.
Related Issues (19)
- Investigate integrating Brackets StringMatch as algorithm for partial hint proposal matching HOT 1
- [codehint]extra hints show up, but not start after the current searching string. HOT 1
- Use code intelligence information in Brackets Quick Open feature to support other types of symbols HOT 2
- Function signature hints showing ?
- Consider deprioritizing identifiers that come from .json definition files instead of sources HOT 2
- jumping to an object created with {} not working correctly. HOT 1
- Hinting of String literals HOT 2
- Reload sometimes required to get .prototype proposals HOT 1
- Inconsistent information for module hints HOT 1
- Jump to definition not working for var exported from a module HOT 1
- Hints appear immediately after comma in object literal HOT 3
- Improve hints for function types. HOT 1
- HintUtils.maybeIdentifier excludes valid javascript identifiers HOT 2
- Function hints show the function name as fn() instead of the variable being called.
- Improve guess proposals when type is not known HOT 1
- Add support for different RequireJS styles. HOT 1
- Expose go-to-definition from JavaScriptCodeHints extension. HOT 2
- Find a function's invocations HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brackets.