clausreinke / typescript-tools

(repo no longer active) Tools related to the TypeScript language
Apache License 2.0
266 stars 29 forks source link

Request for Simple Example #2

Closed damassi closed 11 years ago

damassi commented 11 years ago

I've been experimenting with your typescript services and can't quite wrap my head around how to use it properly. I was wondering if you could create a simple 'test' folder and, in it, provide a basic typescript file and a README with instructions about how to execute commands on the methods and sources within.

But perhaps I'm simply doing something wrong: After loading the server, when attempting this command:

definition 8 18 /usr/local/lib/node_modules/typescript-tools/tss.ts
"TSS command processing error: Error: Interal error: No AST found for file "/usr/local/lib/node_modules/typescript-tools/tss.ts"."

I get an AST error.

Any help would be appreciated.

clausreinke commented 11 years ago

Thanks for testing. tss should be fairly fault-tolerant (almost too much so), so even if you don't have the TypeScript sources cloned at the right relative path, you can still get some information by applying tss to its own sources. That doesn't mean that the docs (such as they are) don't need improvement (currently, the best documentation of the json format is the source:-(, and I hope to get around to a blog post or perhaps screencast next week.

The error message suggests that the file has not been loaded, or at least not under that path - how did you start the server, and what path did it output? Also, there isn't anything on line 8 in tss.ts, so you wouldn't get any information even if that path was loaded.

Here is a simple example, with the current tss sources, without the TypeScript sources installed

git clone git://github.com/clausreinke/typescript-tools.git
cd typescript-tools/
npm install -g
$ tss tss.ts
"loaded c:/javascript/typescript/tst/typescript-tools/tss.ts, TSS listening.."
symbol 327 5 c:/javascript/typescript/tst/typescript-tools/tss.ts
"setup:(file: any) => void"
> symbol 327 1 c:/javascript/typescript/tst/typescript-tools/tss.ts
"tss: TSS"
> definition 327 1 c:/javascript/typescript/tst/typescript-tools/tss.ts
{"def":{"unitIndex":4,"minChar":10581,"limChar":10603,"kind":"variable","name":"
tss","containerKind":"","containerName":"__GLO"},"file":"c:/javascript/typescrip
t/tst/typescript-tools/tss.ts","min":[325,3],"lim":[326,23]}
quit
"TSS closing"
damassi commented 11 years ago

Thanks for posting this. Extremely helpful, and now I'm getting source information.

Edit: this tool works really good; i'll post an update once my sublime plugin has been completed.