td-completes-me
td-completes-me copied to clipboard
Basic TD Types not recognized
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 [email protected]
Cheers Ivan DelSol Head Python Wizard at Derivative
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
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?
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.