3

I see in Visual Studio Code 0.5.0 that the /// <reference path="../typings/jquery/jquery.d.ts"/> can be removed from the .js files and added into an overriding jsconfig.json file. I have therefore dropped the jsconfig.json file into the root directory of my project.

However, when I create the file jsconfig.json and add a line referring to the above path to the jquery.d.ts file and remove the /// <reference path .... from my .js files, I am not seeing the intellisense return. As I would expect it to with Visual Studio Code.

The jsconfig.json file I had created was:

{
    "files": [
        "../typings/jquery/jquery.d.ts"
    ]
}

Maybe I am missing the point of the jsconfig.json file.

2 Answers 2

5

You don't need to add "files" to your jsconfig.json file. The only reason you need to do that is if you want a specific set.

Instead, remove the files array. It sounds like it still won't work at that point based on your description. My assumption then is you do not have the .\typings\tsd.d.ts" file. It seems to read that to references the correct files. In order to get that, you need to do "tsd install node --save".

1
  • Thanks. It is just from what I read on VS Code website, the impression I got, was that by putting in files in jsconfig.json, the path to jquery.d.ts, would allow avoid adding the /// references to each file . The path to the jquery.d.ts, was the same one used by the /// reference.
    – NeilM
    Jul 8, 2015 at 12:12
3

You need to adjust your file paths relative to jsconfig.js.

I.e. define files like:

{
    "files": [
        "typings/jquery/jquery.d.ts"
    ]
}
5
  • Bah, needed longer to edit my comment. Anyway I have reread the comment - We changed two things: You can now define a project using a jsconfig.json file and we optimistically load existing d.ts-files from you workspace. from blogs.msdn.com/b/vscode/archive/2015/07/06/vs-code-es6.aspx and I am wondering is VS code meant to pre load the typings from the typings sub directory. If it is then it doesn't seem to. If you are meant to have a jsconfig.json file to make it work, then I had assumed it would go in the root directory of the project.
    – NeilM
    Jul 25, 2015 at 20:49
  • ps - How to you add a return in using the editor or do you edit outside and then paste in?
    – NeilM
    Jul 25, 2015 at 20:50
  • I'm not sure what VC code blog means by "optimistically loading". What worked for me was placing jsconfig.js to project root and referencing d.ts-files relative to it (or project root). My current setup actually references just one bundled "typings/tds.d.ts".
    – iaarnio
    Jul 27, 2015 at 8:15
  • Re "jsconfig.js": Do you mean "jsconfig.json"? If not, can you address it in your answer? (But without "Edit:", "Update:", or similar - the answer should appear as if it was written today.) Apr 22, 2022 at 12:01
  • True, it seems to be typo. This is very old case and I do not recall details for this. Syntax for sure is JSON so I think the file type extension should be too.
    – iaarnio
    Apr 23, 2022 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.