mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 18:42:27 +01:00
Properly allow $ in identifiers in JS completer
This commit is contained in:
@@ -279,12 +279,12 @@ liberator.Completion = function () //{{{
|
|||||||
{
|
{
|
||||||
// A word character following a non-word character, or simply a non-word
|
// A word character following a non-word character, or simply a non-word
|
||||||
// character. Start a new statement.
|
// character. Start a new statement.
|
||||||
if (/[\w$]/.test(c) && !/[\w\d$]/.test(lastChar) || !/[\w\d\s]/.test(c))
|
if (/[\w$]/.test(c) && !/[\w\d$]/.test(lastChar) || !/[\w\d\s$]/.test(c))
|
||||||
top[STATEMENTS].push(i);
|
top[STATEMENTS].push(i);
|
||||||
|
|
||||||
// A "." or a "[" dereferences the last "statement" and effectively
|
// A "." or a "[" dereferences the last "statement" and effectively
|
||||||
// joins it to this logical statement.
|
// joins it to this logical statement.
|
||||||
if ((c == "." || c == "[") && /[\w\d\])"']/.test(lastNonwhite)
|
if ((c == "." || c == "[") && /[\w\d$\])"']/.test(lastNonwhite)
|
||||||
|| lastNonwhite == "." && /[\w$]/.test(c))
|
|| lastNonwhite == "." && /[\w$]/.test(c))
|
||||||
top[STATEMENTS].pop();
|
top[STATEMENTS].pop();
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ liberator.Completion = function () //{{{
|
|||||||
{
|
{
|
||||||
case "(":
|
case "(":
|
||||||
/* Function call, or if/while/for/... */
|
/* Function call, or if/while/for/... */
|
||||||
if (/\w/.test(lastNonwhite))
|
if (/\w$/.test(lastNonwhite))
|
||||||
{
|
{
|
||||||
top[FUNCTIONS].push(i);
|
top[FUNCTIONS].push(i);
|
||||||
top[STATEMENTS].pop();
|
top[STATEMENTS].pop();
|
||||||
|
|||||||
Reference in New Issue
Block a user