Skip to content
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

Basic TD Types not recognized #2

Open
sunsp1der opened this issue Apr 30, 2020 · 3 comments
Open

Basic TD Types not recognized #2

sunsp1der opened this issue Apr 30, 2020 · 3 comments
Assignees

Comments

@sunsp1der
Copy link

This is super awesome. I'd love to help make this our go-to Python editor tool.

First thing. It doesn't seem to recognize basic TD types, like op, COMP, DAT etc. All that stuff is in the main locals. I've never written an editor extension but I'm into it if you want a hand.

Hit me up at my personal email sunspider@gmail.com

Cheers
Ivan DelSol
Head Python Wizard at Derivative

@picturesbyrobots picturesbyrobots self-assigned this May 1, 2020
@picturesbyrobots
Copy link
Owner

picturesbyrobots commented May 1, 2020

Hey Ivan!
Always nice to speak to someone over at the mothership! Thanks for having a look at this project. The more hands the merrier!

Can you elaborate a bit on the steps that I can take to reproduce this issue? The VsCode extension doesn't really know anything about the basic TD Types. All it's really doing is passing the text of the document currently requesting the completion, the position of the cursor, and a couple other things to the extension. Here's the call in server.ts :

results = await axios.post('http://localhost:1338', JSON.stringify({current_document , lines,line_idx, char})+ "\n")

the rest of the heavy lifting is actually done on Touch Designer side. We start by calling a tokenizer function to split the line currently being edited into tokens.

The idea was to use a series of regular expressions to parse the code around the line and attempt to return some valuable completions. The expressions that it's currently using can be found in src\lib_tokenizer.py

Right now it mostly uses the dir function to pull the completion info to send back to VsCode. I'm not super sure what is meant by all that stuff being in the main locals.

cheers!
-d

@sunsp1der
Copy link
Author

sunsp1der commented May 1, 2020

Oh I see... you're only doing a code completion thing. I was looking at all the undefined variable warning underlines in the rest of the code. So this line:

popDialog = op.TDResources.op('popDialog')
will complain because it doesn't know what "op" is.

Do you know how we can tell VS about predefined Python objects?

@picturesbyrobots
Copy link
Owner

yeah. that's very much correct. That's sort of on the long term road map but potentially a bit more involved than a simple auto-complete engine. I think that it would probably involve writing or extending some sort of linting extension for VsCode or returning Linting markup from TD-Completes Me

Normally when I know I'm working on a TD project I just turn off the linting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants