pohmelie / cuda_tern Goto Github PK
View Code? Open in Web Editor NEWThis project forked from kvichans/cuda_tern
CudaText plugin to use Tern - Intelligent JavaScript tooling
This project forked from kvichans/cuda_tern
CudaText plugin to use Tern - Intelligent JavaScript tooling
yoba.js:
var yoba2 = require("./yoba2")
function yoba(a, b) {
return a + b;
}
function foo(x) {
return x;
}
yoba(foo(yoba(1, 2)), 3)
yoba2.b|ar()
yoba2.js:
function bar(a, b) {
var c = [];
return a * b;
}
yoba(1, 2)
|
โ is cursor.
On references call:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/poh/tools/cudatext/py/cuda_tern/__init__.py", line 272, in show_usages
normalize_caret(*caret),
File "/home/poh/tools/cudatext/py/cuda_tern/__init__.py", line 365, in get_references
expandWordForward=False, # need when caret inside funcname
File "/home/poh/tools/cudatext/py/cuda_tern/__init__.py", line 62, in do_request
req = opener.open(url, s, timeout=TERN_TIMEOUT)
File "/usr/lib/python3.5/urllib/request.py", line 472, in open
response = meth(req, response)
File "/usr/lib/python3.5/urllib/request.py", line 582, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.5/urllib/request.py", line 510, in error
return self._call_chain(*args)
File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
result = func(*args)
File "/usr/lib/python3.5/urllib/request.py", line 590, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request
LINE_GOTO_OFFSET=5
def goto_file(self, filename, num_line, num_col):
if not os.path.isfile(filename): return
file_open(filename)
ed.set_prop(PROP_LINE_TOP, str(max(0, num_line-LINE_GOTO_OFFSET)))
ed.set_caret(num_col, num_line)
msg_status('Go to file: '+filename)
print('Goto "%s", Line %d'%(filename, num_line+1))
can we pass TERN_TIMEOUT to tern too?
@pohmelie
when no Tern,
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "/home/user/.cudatext/py/cuda_tern/__init__.py", line 14, in <module>
stdout=subprocess.PIPE,
File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'tern'
opener = urllib.request.build_opener(...
Can we create it one time? not each req?
now get of filename works for Tern tests, dont work for 1 file test.
How to get full filename from tern?
# Tern gives "test/reload.js" while we edit "reload.js" in "test"
dirname = os.path.dirname(os.path.dirname(ed.get_filename()))
if dirname:
filename = os.path.join(dirname, filename)
(sx, sy), (ex, ey), *_ = token
Need check for tokens ended. ie get_token()==None
Can u make method which gets docstr for cur function, and does print(s)? @pohmelie
127.0.0.1 is always ok, all OSes? "localhost" better.
i cannot run tern on 2nd PC. "tern" dont give output.
Cud shows
Traceback (most recent call last):
File "/usr/lib/python3.4/http/client.py", line 786, in _get_hostport
port = int(host[i+1:])
ValueError: invalid literal for int() with base 10: 'None'
ST plg sees is it coment/string:
if view.score_selector(sel, 'string.quoted') > 0: return None
if view.score_selector(sel, 'comment') > 0: return None
todo here.
In on_goto_def, return True, else Cud shows in statusbar "No goto def plugins installed"
function yoba(a, b) {
return a + b;
}
function foo(x) {
return x;
}
yoba(foo(yoba(1, 2))|, 3)
|
is cursor position.
So, on ctrl-shift-space
there should be hint about yoba
arguments. To achieve this we should get token at caret position. And move "left" through tokens to find first yoba
call.
For this cuda API should return index of token on get_token
call too.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.