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

Javascript support broken? jsconfig.json's file directive is ignored, and intellisense doesn't work #2265

Closed
manad777 opened this issue Jan 26, 2016 · 19 comments
Assignees
Labels
javascript JavaScript support issues

Comments

@manad777
Copy link

I used the first jsconfig.json example from https://code.visualstudio.com/Docs/languages/javascript in my project. According to the doc this config should only let app.js be visible in the left pane, but as you can see in the screenshot below it's not the case. I tried restarting Code, of course.

screenshot - 01252016 - 11 29 24 pm

Similarly, Intellisense doesn't work at all. I installed typings using the tsd commands mentioned at https://code.visualstudio.com/Docs/runtimes/nodejs (they're visible in the screenshot), but autocomplete for commonjs modules is not working. A google search had people mentioning a tsd.d.ts file in the typings/ directory, but tsd didn't create one for me. I tried creating one by hand and populating it using the content with the entries below pointing at existing files, but autocomplete is still unavailable.
/// <reference path="node/node.d.ts" /> /// <reference path="lodash/lodash.d.ts" />

Does VS Code actually support Javascript, or did I completely misunderstand the doc?

@justsml
Copy link

justsml commented Jan 26, 2016

@justsml
Copy link

justsml commented Jan 26, 2016

vscode-lodash-autocomplete

Here's my tsd.d.ts

/// <reference path="angularjs/angular.d.ts" />
/// <reference path="express/express.d.ts" />
/// <reference path="jquery/jquery.d.ts" />
/// <reference path="lodash/lodash.d.ts" />
/// <reference path="superagent/superagent.d.ts" />
/// <reference path="supertest/supertest.d.ts" />

@jrieken jrieken added the javascript JavaScript support issues label Jan 26, 2016
@manad777
Copy link
Author

My problems remain.

I've set up a repo showing the issue: https://github.com/manad777/vscodetest .
If you clone that repo, do you get lodash's autocomplete in app.js?

I feel there is fundamental broken here, because I don't see what I'm doing anything different from you. What version of VSCode are you using? Here's a complete list of my issues on 0.10.5:

FILE EXCLUSION

  1. https://code.visualstudio.com/Docs/languages/javascript states that the "files" entry in jsconfig.json's will only show those files, implicitly excluding all others. Yet all files remain visible, not just app.js.
  2. https://code.visualstudio.com/Docs/languages/javascript states that the "exclude" entry in jsconfig.json will excluse directories matching that name. However, folder-to-be-ignored remains visible.
  3. https://code.visualstudio.com/Docs/languages/javascript states "By default, VS Code excludes .git, node_modules, bower_components, jspm_packages, tmp, and temp folders." However, node_modules remains visible (I didn't bother trying the others).

AUTOCOMPLETE/INTELLISENSE

I ran the following commands:
npm install lodash --save
tsd init
tsd install lodash --save

Yet, in app.js, I don't get autocomplete after _. If I press Ctrl+Space after the dot, I get "No suggestions".

@justsml
Copy link

justsml commented Jan 27, 2016

Strange on the autocomplete issue. I've seen something similar related to the default open-file limits in Mac & Linux. Can you post the results of this cmd: ulimit -a

@justsml
Copy link

justsml commented Jan 27, 2016

Here are some related issues:
#1081 and #703

@manad777
Copy link
Author

user1@ubuntu-webdev:~$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 7922
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 7922
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

This is on Ubuntu 14.04.

The issues you linked seem related to large amount of files in the project, or the name of directories in the path containing "js". I can reproduce it with nothing but a single app.js file in the root directory.

@unional
Copy link

unional commented Jan 29, 2016

I can confirm that files in jsconfig.json is not working. exclude does work.
https://github.com/coolcodeexamples/timely-wealth-game
https://github.com/coolcodeexamples/timely-wealth-game/tree/files-not-working

Related issue (on the createServer() part):
typed-typings/npm-http-server#1

@unional
Copy link

unional commented Jan 29, 2016

@manad777 I don't see the doc says it will "hide the files in the left pane". My understanding is that it only govern intelliSense. Am I wrong?

@ghost
Copy link

ghost commented Mar 3, 2016

+1 the same problem of lodash and _.

Intellisense doesn't work.

@egamma
Copy link
Member

egamma commented Mar 4, 2016

https://code.visualstudio.com/Docs/languages/javascript states that the "files" entry in jsconfig.json's will only show those files, implicitly excluding all others. Yet all files remain visible, not just app.js.

The misunderstanding is the sentence The file itself lists the files belonging to the project as well as compiler options. The explorer shows all files not only the files belonging to the project defined in the jsconfig.json.

Similarly, Intellisense doesn't work at all. I installed typings using the tsd commands mentioned at https://code.visualstudio.com/Docs/runtimes/nodejs (they're visible in the screenshot),

In your jsconfig.json you define that only app.js belongs to the project, therefore the typings folder is not considered. You either need to remove the files section or add the .d.ts folders to the files list.

@egamma egamma closed this as completed Mar 4, 2016
@manad777
Copy link
Author

manad777 commented Mar 5, 2016

@egamma , thanks for clarifying that the explorer will always show everything regardless of configuration. It's not a bug, then.

However, this issue shouldn't be closed yet. Neither of your suggestions to fix intellisense worked for me. I tried removing the files entry altogether, and I tried adding every single typings path I could think of. In both cases I restarted VSCode. And in both cases, I still had no intellisense in app.js.

My example project has 2 new commits that you can peruse: https://github.com/manad777/vscodetest/commits/master

@egamma egamma reopened this Mar 6, 2016
@egamma
Copy link
Member

egamma commented Mar 6, 2016

I've changed the jsconfig.json as follows:

{
    "compilerOptions": {
        "target": "ES6",
        "module": "commonjs"
    },
    "exclude": [
        "node_modules"
    ]
}

Now it works for me
image

@unional
Copy link

unional commented Mar 6, 2016

#2265 (comment)

I think exclude does work. But not for files.

@egamma
Copy link
Member

egamma commented Mar 6, 2016

@unioal thanks and agreed, the exclude setting has no impact on the behaviour. I can remove it from the jsconfig.json and I still get Intellisense.

@egamma
Copy link
Member

egamma commented Mar 6, 2016

The following jsconfig.json works for me in VS Code 0.10.10 available on the insider channel.

jsconfig.json

{
    "compilerOptions": {
        "target": "ES6",
        "module": "commonjs"
    },
    "files": [
        "app.js",
        "typings/lodash/lodash.d.ts"
    ]
}

image

@egamma egamma closed this as completed Mar 6, 2016
@unional
Copy link

unional commented Mar 6, 2016

Thanks. @egamma . I just reconfirming that it is working too. 🍺

@gvolkan
Copy link

gvolkan commented Mar 10, 2016

Thanks @egamma,
may the force be with you :)

@manad777
Copy link
Author

Even after @egamma 's suggested jsconfig.json Intellisense wouldn't work. Then I deleted ~/.config/Code and tried again, and it worked. I've been using VS Code for a few months now, so it could have been caused by an artifact from an old version.

@blopez2010
Copy link

blopez2010 commented Jul 26, 2016

The solution works with small projects but if it is a large project it doesn't work on VSCode version 1.3.1 @egamma do you have something related to it? I have read about it in the web and it seems to be a real issue, actually I made some changes excluding folders but it takes like 3 minutes trying to get the intellicense, and sometimes takes more time to do so.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
javascript JavaScript support issues
Projects
None yet
Development

No branches or pull requests

7 participants