Coder Social home page Coder Social logo

cuda_tern's People

Contributors

alexey-t avatar kvichans avatar pohmelie avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

cudatext-addons

cuda_tern's Issues

References fail

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

Here is for future, goto

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))

Show err, if no Tern installed

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'

url request

opener = urllib.request.build_opener(...

Can we create it one time? not each req?

Wrong autocompl with Tern test

Get Tern js code
folder tern-master/test
util.js has 2 funcs addFile, addTest

Open reload.js, line 9, put caret after "util.add"
I see one result, must be 2

tern2

Rework get filename

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)

need check

(sx, sy), (ex, ey), *_ = token
Need check for tokens ended. ie get_token()==None

Docstring

Can u make method which gets docstr for cur function, and does print(s)? @pohmelie

host addr

127.0.0.1 is always ok, all OSes? "localhost" better.

Show er, if Tern cant start

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'

todo: see comment/string

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.

Goto-def fix

In on_goto_def, return True, else Cud shows in statusbar "No goto def plugins installed"

Searching caller for proper argument hinting

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.