Commit Graph
51 Commits
Author SHA1 Message Date
Kevin Dangoor c40b60b94a Makes reformatting code hints explicit.
Adds a handleWideResults to hint responses (only active for function signature hints right now).
The CodeHintList changes the styling and behavior a bit to suit.
2013-05-21 09:08:40 -04:00
dloverin 8642920d8c fix hinting on non-ascii characters 2013-05-17 07:43:08 -04:00
dloverin 8142ccdeb6 Fix a bug where the hinter was not failing over to gueses. Added code to Session.getHints to detect when guesses are needed so the caller can get the guesses from tern and call getHints again. 2013-05-15 12:37:43 -04:00
Kevin Dangoor 9672c7e19d Fix for #3589. In code hints, sort leading _ names to bottom.
This also alters StringMatch.multiFieldSort to use an array to define the sort order,
though I stopped short of deprecating the old { key: priority } format.
2013-05-14 12:42:16 -04:00
dloverin 47de2cb19c Merge branch 'master' into load-subdirs 2013-05-13 08:29:31 -04:00
dloverin cb5572ce04 handle getting guesses in the completions message and remove the properties message 2013-05-13 08:18:35 -04:00
Erik Tierney 5b0c47008a Add @return jsdoc annotation 2013-05-10 16:24:11 -04:00
Erik Tierney dfdff356a6 Fix Issue #3614
Don't hint on function, parameter, or variable declarations.
no hints for
var fo// we used to pop up hints here
2013-05-10 16:00:16 -04:00
dloverin dc9aba5fca Merge branch 'master' into load-subdirs 2013-05-10 12:43:28 -04:00
dloverin f2ba60c17f load additional files if the loaded files are not using modules.
refactored unittest files.
2013-05-10 12:34:17 -04:00
Erik Tierney c162a75dc8 Merge branch 'master' into html-script-hinting 2013-05-09 14:25:58 -04:00
Erik Tierney 7882eac4f6 Fix Issue #3632
Only replace the 'fn' in the function type hint if the token that was called looks like an identifier/property.  If it is an expression, resulting in a function call, then just display 'fn' since we don't have a way to determine a 'name' for the called function.
2013-05-07 14:20:19 -04:00
Randy Edmunds e73a877ee6 change deprecated .className to .type 2013-05-05 11:25:25 -07:00
Randy Edmunds 53bf87ed22 Revert "Merge pull request #3697 from jeffslofish/Issue-3676"
This reverts commit 9e99101057, reversing
changes made to a9e27717f4.
2013-05-05 10:46:07 -07:00
Jeffrey Fisher 0904c5de19 Changed one instance of the depreciated ".className" to ".type" that were being used on objects returned from the getTokenAt() method that was missed during a merge. 2013-05-04 22:31:12 -07:00
Erik Tierney 84c239cf39 Merge branch 'master' into html-script-hinting
Fixup branch so it will merge cleanly again.

Conflicts:
	src/extensions/default/JavaScriptCodeHints/unittests.js
2013-05-03 14:50:57 -04:00
Erik Tierney 5d7dc76dfb refactor HTMLUtils.findStyleBlocks to find arbitrary blocks.
The js code hinting code needed to find script blocks, so refactor the style block code to find any kind of block, and call that instead of having another copy of the code.  findStyleBlocks now just calls the generic method, looking for "css" blocks.

Also fixed up the block finding code to handle empty blocks, which I ran into when looking for "javascript" blocks.
2013-05-03 11:29:43 -04:00
dloverin d8b960d12f Merge pull request #3598 from eztierney/iss-3511
[JS Code Hints] Fix Issue #3511
2013-05-03 08:19:29 -07:00
Erik Tierney 9416e75828 Add tests for jscodehints in an html file.
Also fix some bugs with jump-to-def and function type hints uncovered by the tests.
2013-05-02 16:28:40 -04:00
Erik Tierney 0755c30d58 Basic support for code hinting in html files.
For HTML files, we replace the HTML sections with whitespace, leaving only the text of the script tags for Tern to see.
This way the offset/cursor positions don't need to be translated, which would be necessary to get jump-to-def to work.
2013-05-02 16:28:39 -04:00
dloverin 52d98980f0 Close hints when the cursor moves to a new hinting context 2013-04-26 09:57:08 -04:00
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 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 7b31da7705 fix problem where jQuery was not recognized as a builtin 2013-04-18 11:26:45 -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 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
Erik Tierney fa2bebcfa0 Cleanup - mostly deleting unused code 2013-04-11 15:49:07 -04:00
Erik Tierney d5453276e1 fixes #2 and #4 - function type hinting
Display the called properties name instead of "fn".
don't display "?" if the function type could not be determined.
2013-04-05 16:04:29 -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 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 9bf0b9f7d2 fix bug where no hints would be provided after '(' 2013-03-29 14:53:55 -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
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
Erik Tierney 832aaa2e14 prototyping hooking up ternjs to power codehints.
Currently only works in 1 file
tern does not yet run in a web worker
Code Hinting plugin now uses tern hints for property completions, and falls back to its own heuristics if tern does not have any hints.
2013-03-18 15:14:53 -04:00
Joel Brandt 1f1d074180 more doc fixups 2013-02-26 09:53:54 -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 27b7dce115 Address initial comments and suggestions from code review by @rlim. 2013-02-21 11:01:14 -08:00