Closed nhooyr closed 8 years ago
There also a few debug statements that should be commented
@nhooyr debug comments it is just for some errors that will happens... I am still working on this, and will be most bugs to fix.
@carlitux You must set self.input_pattern
in your source.
self.input_pattern = r'\.\w*'
I have reviewed your source code. It does not show the candidates. It seems the source's problem. deoplete calls the source correctly.
@Shougo thanks! I was debugging and with your last commit and the
self.input_pattern = r'\.\w*'
it is working and firing the gather candidates but fuzzy filter is removing all here some messages debug
document.bo|
messages:
'"ternjs"' # Source
'"****************************************************************************************************"'
'[{"word": "body", "info": "Element\nReturns the <body> or <frameset> node of the current document.", "menu": "(obj)"}]' # candidates
'"****************************************************************************************************"'
'"<bound method Filter.filter of <deoplete.filters.matcher_length.Filter object at 0x1037a0780>>"'
'[{"word": "body", "info": "Element\nReturns the <body> or <frameset> node of the current document.", "menu": "(obj)"}]'
'"<bound method Filter.filter of <deoplete.filters.matcher_fuzzy.Filter object at 0x1037a0320>>"'
'[]' # candidates
'"<bound method Filter.filter of <deoplete.filters.sorter_rank.Filter object at 0x1037a0978>>"'
'[]' # candidates
'"<bound method Filter.filter of <deoplete.filters.converter_remove_overlap.Filter object at 0x1037979b0>>"'
'[]' # candidates
Another
var foo = ["array", "of", "strings"].|
messages:
'"ternjs"'
'"****************************************************************************************************"'
'[{"menu": " (fn)", "word": "concat", "info": "fn(other: [?])\nReturns a new array comprised of this array joined with other array(s) and/or value(s)."}, {"menu": " (fn)", "word": "copyWithin", "info": "
fn(target: number, start: number, end?: number)\nThe copyWithin() method copies the sequence of array elements within the array to the position starting at target."}, {"menu": " (fn)", "word": "entries",
"info": "fn()\nThe entries() method returns a new Array Iterator object that contains the key/value pairs for each index in the array."}, {"menu": " (fn)", "word": "every", "info": "fn(test: fn(elt: ?,
i: number, array: Array) -> bool, context?: ?) -> bool\nTests whether all elements in the array pass the test implemented by the provided function."}, {"menu": " (fn)", "word": "fill", "info": "fn(value:
?, start?: number, end?: number)\nThe fill() method fills all the elements of an array from a start index to an end index with a static value."}, {"menu": " (fn)", "word": "filter", "info": "fn(test: fn
(elt: ?, i: number, array: Array) -> bool, context?: ?)\nCreates a new array with all elements that pass the test implemented by the provided function."}, {"menu": " (fn)", "word": "find", "info": "fn(ca
llback: fn(element: ?, index: number, array: [?]) -> bool, thisArg?: ?)\nThe find() method returns a value in the array, if an element in the array satisfies the provided testing function."}, {"menu": "
(fn)", "word": "findIndex", "info": "fn(callback: fn(element: ?, index: number, array: [?]), thisArg?: ?) -> number\nThe findIndex() method returns an index in the array, if an element in the array satis
fies the provided testing function."}, {"menu": " (fn)", "word": "forEach", "info": "fn(f: fn(elt: ?, i: number, array: Array), context?: ?)\nExecutes a provided function once per array element."}, {"men
u": " (fn)", "word": "indexOf", "info": "fn(elt: ?, from?: number) -> number\nReturns the first index at which a given element can be found in the array, or -1 if it is not present."}, {"menu": " (fn)",
"word": "join", "info": "fn(separator?: string) -> string\nJoins all elements of an array into a string."}, {"menu": " (fn)", "word": "keys", "info": "fn() -> {:t: number}\nThe keys() method returns a ne
w Array Iterator that contains the keys for each index in the array."}, {"menu": " (fn)", "word": "lastIndexOf", "info": "fn(elt: ?, from?: number) -> number\nReturns the last index at which a given elem
ent can be found in the array, or -1 if it is not present."}, {"menu": " (num)", "word": "length", "info": "number\nAn unsigned, 32-bit integer that specifies the number of elements in an array."}, {"men
u": " (fn)", "word": "map", "info": "fn(f: fn(elt: ?, i: number, array: Array), context?: ?)\nCreates a new array with the results of calling a provided function on every element in this array."}, {"menu
": " (fn)", "word": "pop", "info": "fn()\nRemoves the last element from an array and returns that element."}, {"menu": " (fn)", "word": "push", "info": "fn(newelt: ?) -> number\nMutates an array by appen
ding the given elements and returning the new length of the array."}, {"menu": " (fn)", "word": "reduce", "info": "fn(combine: fn(sum: ?, elt: ?, i: number, array: Array), init?: ?)\nApply a function aga
inst an accumulator and each value of the array (from left-to-right) as to reduce it to a single value."}, {"menu": " (fn)", "word": "reduceRight", "info": "fn(combine: fn(sum: ?, elt: ?, i: number, arra
y: Array), init?: ?)\nApply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value."}, {"menu": " (fn)", "word": "reverse", "info": "fn()\nRevers
es an array in place. The first array element becomes the last and the last becomes the first."}, {"menu": " (fn)", "word": "shift", "info": "fn()\nRemoves the first element from an array and returns th
at element. This method changes the length of the array."}, {"menu": " (fn)", "word": "slice", "info": "fn(from?: number, to?: number)\nReturns a shallow copy of a portion of an array."}, {"menu": " (fn)
", "word": "some", "info": "fn(test: fn(elt: ?, i: number, array: Array) -> bool, context?: ?) -> bool\nTests whether some element in the array passes the test implemented by the provided function."}, {"
menu": " (fn)", "word": "sort", "info": "fn(compare?: fn(a: ?, b: ?) -> number)\nSorts the elements of an array in place and returns the array."}, {"menu": " (fn)", "word": "splice", "info": "fn(pos: num
ber, amount: number, newelt?: ?) -> [?]\nChanges the content of an array, adding new elements while removing old elements."}, {"menu": " (fn)", "word": "unshift", "info": "fn(newelt: ?) -> number\nAdds o
ne or more elements to the beginning of an array and returns the new length of the array."}, {"menu": " (fn)", "word": "values", "info": "fn()\nThe values() method returns a new Array Iterator object tha
t contains the values for each index in the array."}]'
'"****************************************************************************************************"'
'"<bound method Filter.filter of <deoplete.filters.matcher_length.Filter object at 0x10bd9c6d8>>"'
'[{"menu": " (fn)", "word": "concat", "info": "fn(other: [?])\nReturns a new array comprised of this array joined with other array(s) and/or value(s)."}, {"menu": " (fn)", "word": "copyWithin", "info": "
fn(target: number, start: number, end?: number)\nThe copyWithin() method copies the sequence of array elements within the array to the position starting at target."}, {"menu": " (fn)", "word": "entries",
"info": "fn()\nThe entries() method returns a new Array Iterator object that contains the key/value pairs for each index in the array."}, {"menu": " (fn)", "word": "every", "info": "fn(test: fn(elt: ?,
i: number, array: Array) -> bool, context?: ?) -> bool\nTests whether all elements in the array pass the test implemented by the provided function."}, {"menu": " (fn)", "word": "fill", "info": "fn(value:
?, start?: number, end?: number)\nThe fill() method fills all the elements of an array from a start index to an end index with a static value."}, {"menu": " (fn)", "word": "filter", "info": "fn(test: fn
(elt: ?, i: number, array: Array) -> bool, context?: ?)\nCreates a new array with all elements that pass the test implemented by the provided function."}, {"menu": " (fn)", "word": "find", "info": "fn(ca
llback: fn(element: ?, index: number, array: [?]) -> bool, thisArg?: ?)\nThe find() method returns a value in the array, if an element in the array satisfies the provided testing function."}, {"menu": "
(fn)", "word": "findIndex", "info": "fn(callback: fn(element: ?, index: number, array: [?]), thisArg?: ?) -> number\nThe findIndex() method returns an index in the array, if an element in the array satis
fies the provided testing function."}, {"menu": " (fn)", "word": "forEach", "info": "fn(f: fn(elt: ?, i: number, array: Array), context?: ?)\nExecutes a provided function once per array element."}, {"men
u": " (fn)", "word": "indexOf", "info": "fn(elt: ?, from?: number) -> number\nReturns the first index at which a given element can be found in the array, or -1 if it is not present."}, {"menu": " (fn)",
"word": "join", "info": "fn(separator?: string) -> string\nJoins all elements of an array into a string."}, {"menu": " (fn)", "word": "keys", "info": "fn() -> {:t: number}\nThe keys() method returns a ne
w Array Iterator that contains the keys for each index in the array."}, {"menu": " (fn)", "word": "lastIndexOf", "info": "fn(elt: ?, from?: number) -> number\nReturns the last index at which a given elem
ent can be found in the array, or -1 if it is not present."}, {"menu": " (num)", "word": "length", "info": "number\nAn unsigned, 32-bit integer that specifies the number of elements in an array."}, {"men
u": " (fn)", "word": "map", "info": "fn(f: fn(elt: ?, i: number, array: Array), context?: ?)\nCreates a new array with the results of calling a provided function on every element in this array."}, {"menu
": " (fn)", "word": "pop", "info": "fn()\nRemoves the last element from an array and returns that element."}, {"menu": " (fn)", "word": "push", "info": "fn(newelt: ?) -> number\nMutates an array by appen
ding the given elements and returning the new length of the array."}, {"menu": " (fn)", "word": "reduce", "info": "fn(combine: fn(sum: ?, elt: ?, i: number, array: Array), init?: ?)\nApply a function aga
inst an accumulator and each value of the array (from left-to-right) as to reduce it to a single value."}, {"menu": " (fn)", "word": "reduceRight", "info": "fn(combine: fn(sum: ?, elt: ?, i: number, arra
y: Array), init?: ?)\nApply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value."}, {"menu": " (fn)", "word": "reverse", "info": "fn()\nRevers
es an array in place. The first array element becomes the last and the last becomes the first."}, {"menu": " (fn)", "word": "shift", "info": "fn()\nRemoves the first element from an array and returns th
at element. This method changes the length of the array."}, {"menu": " (fn)", "word": "slice", "info": "fn(from?: number, to?: number)\nReturns a shallow copy of a portion of an array."}, {"menu": " (fn)
", "word": "some", "info": "fn(test: fn(elt: ?, i: number, array: Array) -> bool, context?: ?) -> bool\nTests whether some element in the array passes the test implemented by the provided function."}, {"
menu": " (fn)", "word": "sort", "info": "fn(compare?: fn(a: ?, b: ?) -> number)\nSorts the elements of an array in place and returns the array."}, {"menu": " (fn)", "word": "splice", "info": "fn(pos: num
ber, amount: number, newelt?: ?) -> [?]\nChanges the content of an array, adding new elements while removing old elements."}, {"menu": " (fn)", "word": "unshift", "info": "fn(newelt: ?) -> number\nAdds o
ne or more elements to the beginning of an array and returns the new length of the array."}, {"menu": " (fn)", "word": "values", "info": "fn()\nThe values() method returns a new Array Iterator object tha
t contains the values for each index in the array."}]'
'"<bound method Filter.filter of <deoplete.filters.matcher_fuzzy.Filter object at 0x10bd9c278>>"'
'[]'
'"<bound method Filter.filter of <deoplete.filters.sorter_rank.Filter object at 0x10bd9c8d0>>"'
'[]'
'"<bound method Filter.filter of <deoplete.filters.converter_remove_overlap.Filter object at 0x10bd91978>>"'
'[]'
Looks like fuzzy is not working when we have the dot in the autocomplete.
@Shougo just as comment... maybe matcher_fuzzy shouldn't be added by default to filter? only those that need it add to filter?. Jedi, ternjs where this features should be implemented by themself
@carlitux I get it. The source must be set get_complete_position() attribute.
def get_complete_position(self, context):
m = re.search(r'\w*$', context['input'])
return m.start() if m else -1
Otherwise, deoplete uses wrong complete position. So the results are empty.
@Shougo thank you very much! @nhooyr fixed... please test it.
I'm not getting any completions from ternjs anymore?
@nhooyr you have to update deoplete.vim and this.
I did. getting nothing anymore.
could you paste your .tern-project so I can test.
@carlitux thats probably the problem.
{
"libs": [
"browser",
"underscore",
"jquery"
],
"plugins": {
}
}
@nhooyr your .tern-project is fine... this plugin uses tern installed globally.
npm install tern -g
Here you can see that is working with your .tern-project http://recordit.co/sm9VDb3Odi
I did install it globally, everything was working fine before. lol
it has to do with lines 329-230 in ternjs.py
if (self._not_tern_project_file_found):
return []
hm i'll look into it further.
Well that is a little hack that if .tern-project was not found returns empty... this avoids to try start server each time.
ah I had .tern-project
named wrong, totally my fault. working well now.
@nhooyr thanks! also with this issue a lot of bugs were fixed.
Nice. I will disable the default Javascript omni completion pattern in deoplete.
Here http://ternjs.net/doc/demo/#simple
If I complete at
document.|
(|
is my cursor) I get many different completions. However if I do the same with this plugin, I get none.