-
Notifications
You must be signed in to change notification settings - Fork 14
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
enable Automatic Type Acquisition (ATA) #116
Comments
Yes sure! Could you give me some idea (UI, etc) how it could work? |
Include a option in "Eclipse->Settings->JavaScript->Typescript" to enable/disable ATA. If enabled, then "typescript.java" can provide IntelliSense for pure js-files by obtaining the coresponding declaration files of the js-files within the project-root with the help of TS Server and npmjs service. |
Maybe another option would be to have a context menu within the project explorer, such as "refresh ATA". With this, Eclipse User can manually trigger IntelliSense for js-files. So TS IDE does not include or ping npmjs service by itself. However, when enabled in settings, TS IDE can also include declaration files as soon as a js-file is included within the ts-project-folder. For example, user include jquery.js within project root without typescript declaration file, then user triggers "refresh ATA" then TS IDE caches/includes declaration files of jquery to provide intellisense in ts-files. I am not sure about that, but I TS Server has also the ability to provide intellisense for js-files even when no official declaration file of this js-file exists. But I am not sure. |
More information in https://code.visualstudio.com/updates#_better-javascript-intellisense:
So my suggestion of "refresh ATA" is not senseful, because ts server can handle it automatically by package.json. |
@nimo23 could you explain how ATA works with VSCode? I have tried to declare jquery in a package.json {
"dependencies": {
"jquery": "3.1.1"
}
} and open a ts file, type jQuery and I though it that VSCode will download jQuery but it seems that it doesn't work like this. Thanks for your help. |
Is "typescript.disableAutomaticTypeAcquisition" set to "false"? |
Here my settings.json
I'm using VSCode 1.7.2 with TypeScript 2.1.4. |
As said in https://code.visualstudio.com/updates#_better-javascript-intellisense it should work. However, I tested it with a new project and it also does not work. Maybe not ready yet. |
In my editor it works before because I had def files within my old project. However, in new projects, it does not realy work. |
When the download is done? When you open completion? Anyway it seems (according the VSCode code) that ATA is not very complex to implement it since it is managed with tsserver (very cool!). Once I will understand how ATA works with VSCode, I will try to implement it. |
good question. I think, yes, then it should fetch def file. I dont know about performance while opening code completion and fetching resource, IDE source editing could hang..not very user friendly. |
I will study it.
Eclipse Oxygen should provide an async completion feature. I must test that. |
See https://discventionstech.wordpress.com/2016/12/06/vs-code-automatic-type-acquisition-gotchas/ I will test that. It seems that it works only with js files and not with ts files. I will try with VSCode. @nimo23 is that, it works only with js files? |
ATA works only for js-files, ts files dont need ATA. When referencing js files in ts files then ts server use ATA for js files.. |
Ok thanks @nimo23 for your answer. I will try with VSCode and I will try to do the same thing for Eclipse. The cool thing is that the hard task is managed with tsserver, so perhaps the ATA integration could be easy. |
@nimo23 I have studied ATA with typescript.java and as it uses tsserver, ATA works like a charm (tested with TypeScript 2.1.5). But today you must follow the following rules:
And that's all! After that, create a ts file (it works with ts too) like:
Wait few seconds and try to open (Ctrl+Click) the jquery. It should open the ..AppData\Local\Microsoft\TypeScript\node_modules@types\jquery\index.d.ts file I must improve the console to display trace of typings when download is done. |
@nimo23 ATA is now available. See https://github.com/angelozerr/typescript.java/wiki/ATA |
VS Code 1.7.2 has enabled Automatic Type Acquisition (ATA) feature by default (https://code.visualstudio.com/updates). Would be nice to introduce ATA as a option in Typescript Eclipse-Projects as well.
The text was updated successfully, but these errors were encountered: