Commit Graph
97 Commits
Author SHA1 Message Date
Erik Tierney a4c87a6bba Fix Issue #3511
when inserting a hint which is not a valid property name, such as 'my-key', insert the hint as ["my-key"] instead of .my-key.

insertHint now runs the hint through the acorn tokenizer to see if it looks like a valid property name.  If it's invalid, it replaces the '.' with brackets.
Refactored some code in Session.getType() - pulled out a method to find the leading '.' in a property lookup, and use that method from the insertHint logic as well.
Added 3 new unittests to test this new behavior.
2013-04-24 15:40:05 -04:00
Kevin Dangoor 232ee9bb0e Turn on preferPrefixMatches for JS code hints.
Adding this option to string matching provides a fix for #3534 by putting
the matches at the same score and using the scope as a tie breaker.
2013-04-24 10:16:19 -04:00
dloverin e1f43e4271 do not add depth color for builtins 2013-04-23 13:22:03 -04:00
Kevin Dangoor bb7b3c4ce4 Merge branch 'master' of https://github.com/adobe/brackets 2013-04-22 10:16:23 -04:00
Kevin Dangoor 83e5c2de59 Merge branch 'master' into adobe-iwehrman/js-hinter-cruft-removal
Conflicts:
	src/extensions/default/JavaScriptCodeHints/main.js
2013-04-22 10:14:17 -04:00
Kevin Dangoor 5544fd6f38 Merge pull request #3477 from eztierney/codereview-cleanup
Cleanup for comments from pull request #3439, switch to tern hinting
2013-04-22 06:47:48 -07:00
dloverin cb96db453c Fix regressions in the display of literals and keywords in code hints.
1. keywords should be monospace.
2. literals should be dark grey.
2013-04-19 09:40:47 -04:00
Erik Tierney 10f8896d46 cleanup based on codereview comments:
Update jsdoc
use ExtensionUtils.getModulePath instead of manually slicing up path
use FileUtils.readAsText instead of DocumentManager when we only need the text on disk
Call CollectionUtils.hasProperty instead of Object.prototype.hasOwnProperty...
Add comment explaining logic around finding location of called function for function type hinting
remove unnecessary calls to setCursorPos
remove stale comments in unittests
pull out hint invalidation check into a function and remove check for query.length === 0, not necessary anymore
2013-04-18 16:38:40 -04:00
dloverin f6a073ca3d When typing, only automatically show hints for the "." character and JS identifier characters. 2013-04-17 17:29:48 -04:00
Erik Tierney c5052f8e33 Add a couple of unit tests for jump to definition
Only tests in file, inter file needs more work - have to figure out how to make CommandManager work from the unittester.
2013-04-16 18:49:09 -04:00
Erik Tierney daa64a3f3a cleanup from code review
fixed type, delimeter -> delimiter
don't need to escape single quote in double quoted string
2013-04-16 08:48:12 -04:00
dloverin e0c551d624 remove unused hinting for globals 2013-04-15 10:38:59 -04:00
Erik Tierney d96d73d895 cleanup jslint warnings 2013-04-15 09:43:37 -04:00
dloverin 3eee0bef6f use .value instead of .label to reduce confusion 2013-04-13 11:01:46 -04:00
dloverin a2598a9753 sort library globals below user globals
turn on query.guess to get previously used properties of unknown types
turn on query.origins to get categorize library globals vs. user globals
turn on query.expandWordForward to fix hasOwnProperty bug.
2013-04-12 21:00:17 -04:00
dloverin aba25e2705 use StringMatch class to sort hints 2013-04-12 20:54:51 -04:00
Peter Farland ec9a5afa83 Remember the resolved path we used with tern so that jump to definition across files work. Also clean-up some error conditions when the definition location is not known. 2013-04-12 16:51:35 -04:00
Erik Tierney e46d260a09 Get all unit tests passing
Fix a caching problem where old hints were getting used.
Update selection tests to search for the index to insert instead of hardcoding the index so the tests are less fragile.
2013-04-12 15:14:26 -04:00
jeffkenton 51edab6185 Fix Jump-To-Definition bug: trying to open new file when search fails. 2013-04-12 13:42:59 -04:00
jeffkenton 0bab9dc3fd Make Jump-To-Definition switch to new file when definition isn't local to current file. 2013-04-12 11:17:32 -04:00
Erik Tierney 8131900e9b Some unit test cleanup 2013-04-11 15:49:07 -04:00
dloverin 7d52361aa7 Add StringUtils.htmlEscape() back in.
Remove "types" from a tern query since types are not hinted for identifiers or properties.
2013-04-09 14:35:29 -04:00
Ian Wehrman 9bb2a46dbf Remove cruft from the outdated stats-gathering branch. 2013-04-08 13:27:01 -07:00
jeffkenton af9a7f01ab Added Goto Definition. 2013-04-08 15:50:11 -04:00
dloverin dac2002e04 Add guesses to code hints 2013-04-05 13:00:25 -04:00
dloverin c887e8760f new guessing 2013-04-05 12:51:39 -04:00
Peter Farland d371c0f916 Fix JSHint warnings and exclude tern and acorn related files from grunt. 2013-04-04 22:48:21 -04:00
Erik Tierney 98e37b1d1e Merge branch 'master' into tern-experiments
Conflicts:
	src/extensions/default/JavaScriptCodeHints/HintUtils.js
	src/extensions/default/JavaScriptCodeHints/ScopeManager.js
2013-04-03 11:30:12 -04:00
Erik Tierney 63c89f4d62 Add support for hinting function types.
When in a function call, display the function type instead of the normal hints.  This only happens when nothing has been entered by the user - if the user starts typing, then we switch back to the normal hints based on what the user has typed.

This also requires a new version of CodeMirror that brackets has not updated to.  The old hints continue to work without the new version, but the function types will only work once codemirror is updated.
2013-04-02 17:58:05 -04:00
Erik Tierney 08f356c649 Merge pull request #5 from dloverin/cleanup-esprima
Remove espirma and related scope info code
2013-03-29 13:28:17 -07:00
dloverin 0746864409 Remove espirma and related scope info code 2013-03-29 16:08:20 -04:00
dloverin bf7404aa6d Add alphabetical secondary sort when bringing prefix matches to the top 2013-03-29 14:50:52 -04:00
dloverin d947130020 Add alphabetical secondary sort when bringing prefix matches to the top 2013-03-29 14:48:50 -04:00
dloverin 7ac5459e6a fix bug where hints disappear on first character 2013-03-28 16:21:24 -04:00
dloverin 7bfaedfa0a Use tern to sort ids by depth, remove scope info 2013-03-28 15:06:15 -04:00
Bernhard Sirlinger 04d63b1fae Use language id 2013-03-27 23:48:52 +01:00
dloverin 25069f3133 remove console.log 2013-03-26 15:27:18 -04:00
dloverin e4a185543f change tern query not to sort or filter the results 2013-03-26 13:20:10 -04:00
dloverin 7361589145 Merge remote-tracking branch 'upstream/tern-experiments' into tern-experiments
Conflicts:
	src/extensions/default/JavaScriptCodeHints/ScopeManager.js
2013-03-26 09:13:32 -04:00
dloverin f4bcdfc13c case insensitive matches, middle matching, and use tern rawCompletions request 2013-03-25 16:22:49 -04:00
Erik Tierney d648572395 Fix problem where hints are displayed before tern has finished computing the completions.
This means there is now a delay on the first request for hints.
2013-03-21 16:18:32 -04:00
Ian Wehrman 52f3d5a251 Only provide hints for JavaScript files (and not JavaScript within HTML files), and cleanup stale session objects when switching to non-hintable files. 2013-03-06 13:04:16 -08:00
Joel Brandt bc8d9d8e2a more fixes to jsdocs 2013-02-26 06:16:30 -08:00
Ian Wehrman c8b53c7153 type capitalization typos and additional JSDoc annotations 2013-02-25 17:53:00 -08:00
Ian Wehrman c0e75bcc7e Add remaining JSDoc annotations 2013-02-24 12:45:58 -08:00
Ian Wehrman 27b7dce115 Address initial comments and suggestions from code review by @rlim. 2013-02-21 11:01:14 -08:00
Ian Wehrman 786cd23bce Add the JS code hinter as a default extension. 2013-02-14 15:59:12 -08:00