-
Notifications
You must be signed in to change notification settings - Fork 806
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
[hinterland] make all regexes configurable #815
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,56 @@ Type: Jupyter Notebook Extension | |
Main: hinterland.js | ||
Name: Hinterland | ||
Link: README.md | ||
Description: Enable code autocompletion menu for every keypress in a code cell, instead of only enabling it with tab | ||
Description: | | ||
Enable code autocompletion menu for every keypress in a code cell, instead of | ||
only enabling it with tab | ||
Compatibility: 4.x | ||
Parameters: | ||
- name: hinterland.enable_at_start | ||
description: | | ||
Enable hinterland's continuous hinting when notebook is first opened | ||
input_type: checkbox | ||
default: true | ||
- name: hinterland.exclude_regexp | ||
description: | | ||
exclude_regexp: | ||
A regular expression tested against the character before the cursor, which, | ||
if a match occurs, prevents autocompletion from being triggered. | ||
This is useful, for example, to prevent triggering autocomplete on a colon, | ||
which is included by the default Completer.reinvoke pattern. | ||
If blank, no test is performed. | ||
Note that the regex will be created without any flags, making it case | ||
sensitive. | ||
input_type: text | ||
# note that the YAML single-quoted string allows us to use the \ character | ||
# without escaping it, similar to python's raw string syntax | ||
default: ':' | ||
- name: hinterland.include_regexp | ||
description: | | ||
include_regexp: | ||
A regular expression tested against the character before the cursor, which | ||
must match in order for autocompletion to be triggered. | ||
If left blank, the value of the notebook's Completer.reinvoke_re parameter | ||
is used, which can be modified by kernels, but defaults to | ||
/[%0-9a-z._/\\:~-]/i. | ||
Note that although the Completer.reinvoke_re default is case insensitive by | ||
virtue of its /i flag, any regex specified by the user will be created | ||
without any flags, making it case sensitive. | ||
input_type: text | ||
# note that the YAML single-quoted string allows us to use the \ character | ||
# without escaping it, similar to python's raw string syntax | ||
default: '' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The regex entered here is case sensitive, because the /i flag is not added for now when creating the regex object. Perhaps warn the user on that and provide an example regex, eg [%0-9A-Za-z._/\:~-] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good point, worth adding |
||
- name: hinterland.tooltip_regexp | ||
description: | | ||
tooltip_regexp: | ||
A regular expression tested against the character before the cursor, which | ||
if it matches, causes a tooltip to be triggered, instead of regular | ||
autocompletion. | ||
For python, this is useful for example for function calls, so the default | ||
regex matches opening parentheses. | ||
Note that the regex will be created without any flags, making it case | ||
sensitive. | ||
input_type: text | ||
# note that the YAML single-quoted string allows us to use the \ character | ||
# without escaping it, similar to python's raw string syntax | ||
default: '\(' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
tooltip_regexp
character(s) must be included in theinclude_regexp
characters, otherwise this is not fired. Perhaps that the the two regexp have to be merged (or more simply, the test modified perhaps(config.include_regexp.test(pre_cursor) || config.tooltip_regexp.test(pre_cursor) ) && ..
(untested)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, good point. Probably simplest/best to alter the test