Hi,
using the Perl gramar, if I have the cursor on a package name, like Time::Mo|ment, (| is the cursor) and I try to get help, it should try to get help on Time::Moment but right now it only uses Moment.
I had this problem with TM1 also but I fixed it by including : in the definition of the "word". I don't know if this is still the way to do it on TM2 or if there is a better way.
Suggestions?
Thanks,
On 20 Aug 2014, at 22:32, Pedro Melo wrote:
using the Perl gramar, if I have the cursor on a package name, like Time::Mo|ment, (| is the cursor) and I try to get help, it should try to get help on Time::Moment but right now it only uses Moment.
I had this problem with TM1 also but I fixed it by including : in the definition of the "word". I don't know if this is still the way to do it on TM2 or if there is a better way.
There is definitely a better way, since changing word characters would affect word movement, buffer completion, and other things that rely on word definitions.
Looking at the command this is what it does:
word=${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}
A quick fix is to change that line to the following:
word=$(ruby18 -r"$TM_SUPPORT_PATH/lib/current_word" -e"puts Word.current_word(':A-Za-z')")
This calls the `current_word` function from the bundle support bundle. This function looks at the `TM_CURRENT_LINE` and `TM_LINE_INDEX` variables and then extracts the word surrounding the caret based on the allowed characters (passed as its argument).
Can you tell me if the above character range would be correct for perl?
Also, how do I install perl documentation? For me, perldoc reports “no documentation” for my tests (though the command suppresses that, so it’s effectively a no-op, another thing that I’d like to get fixed).
On 22 Aug 2014, at 08:21, Allan Odgaard mailinglist@textmate.org wrote:
On 20 Aug 2014, at 22:32, Pedro Melo wrote:
using the Perl gramar, if I have the cursor on a package name, like Time::Mo|ment, (| is the cursor) and I try to get help, it should try to get help on Time::Moment but right now it only uses Moment.
I had this problem with TM1 also but I fixed it by including : in the definition of the "word". I don't know if this is still the way to do it on TM2 or if there is a better way.
There is definitely a better way, since changing word characters would affect word movement, buffer completion, and other things that rely on word definitions.
Looking at the command this is what it does:
word=${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}
A quick fix is to change that line to the following:
word=$(ruby18 -r"$TM_SUPPORT_PATH/lib/current_word" -e"puts Word.current_word(':A-Za-z')")
This calls the `current_word` function from the bundle support bundle. This function looks at the `TM_CURRENT_LINE` and `TM_LINE_INDEX` variables and then extracts the word surrounding the caret based on the allowed characters (passed as its argument).
Can you tell me if the above character range would be correct for perl?
(':_A-Za-z0-9')
Module names may contain digits.
Also, how do I install perl documentation? For me, perldoc reports “no documentation” for my tests (though the command suppresses that, so it’s effectively a no-op, another thing that I’d like to get fixed).
Documentation should be installed automatically with each module.
I would do some testing but I don't know where "word=${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}" is to test your quick fix.
On 2 Sep 2014, at 13:38, Justin Catterall wrote:
Also, how do I install perl documentation? For me, perldoc reports “no documentation” for my tests (though the command suppresses that, so it’s effectively a no-op, another thing that I’d like to get fixed).
Documentation should be installed automatically with each module.
I would do some testing but I don't know where "word=${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}" is to test your quick fix.
I pushed an updated documentation¹ command with these improvements:
- If caret is on a module e.g. Pod::Html, then the entire module (with namespace) will be looked up. - If no word is under caret, an input dialog is shown. - If no documentation is found, a tool tip is shown.
Your perl bundle should automatically update within the next few hours.
For future reference, you can use Bundles → Select Bundle Item… (⌃⌘T) and do key equivalent search (⌘2) for ⌃H and you’ll find the command responsible for documentation lookup. From this dialog you can click “edit” (or option return) to view (and edit) the source of the command.
¹ https://github.com/textmate/perl.tmbundle/commit/391a076fdbcdce2271da57ab3c6...