<p dir="auto"><em>From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mattflix/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/mattflix">@mattflix</a> on April 24, 2016 10:6</em></p>
<ul dir="auto">
<li>VSCode Version: 1.0.0</li>
<li>OS Version: Mac OS 10.11.3</li>
</ul>
<p dir="auto">Steps to Reproduce:</p>
<ol dir="auto">
<li>Create the example project outlined below. (This is a valid program than runs under Node.)</li>
<li>Intellisense for imports within ./index.js does not work.</li>
</ol>
<p dir="auto">Example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// ./jsconfig.json

{
    &quot;compilerOptions&quot;: {
        &quot;target&quot;: &quot;es6&quot;,
        &quot;module&quot;: &quot;commonjs&quot;
    }
}"><pre class="notranslate"><code class="notranslate">// ./jsconfig.json

{
    "compilerOptions": {
        "target": "es6",
        "module": "commonjs"
    }
}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// ./index.js

var hello = require('foo');

console.log(hello('world'));"><pre class="notranslate"><code class="notranslate">// ./index.js

var hello = require('foo');

console.log(hello('world'));
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// ./node_modules/foo/index.js

module.exports = function(name) {
    return 'hello ' + name;
}"><pre class="notranslate"><code class="notranslate">// ./node_modules/foo/index.js

module.exports = function(name) {
    return 'hello ' + name;
}
</code></pre></div>
<p dir="auto">With VS Code opened to the folder designated by the dot (.) in the paths above, there is no meaningful Intellisense provided for symbol "hello" in ./index.js.  Why not?</p>
<p dir="auto">I did notice that, if an appropriate ./node_modules/foo/index.d.ts file is added, then Intellisense appears.  But, I can't and/or don't want to use a Typescript definition for every module in my program.</p>
<p dir="auto">In any case, TypeScript embellishment is beside the point...   I thought VS Code was <em>supposed</em> to provide some minimum useful Intellisense even for plain Javascript, no?  The advertised "rich editing support" features for Javascript described at <a href="https://code.visualstudio.com/Docs/languages/javascript" rel="nofollow">https://code.visualstudio.com/Docs/languages/javascript</a> certainly implied as much to me.</p>
<p dir="auto">I mean, the static analysis engine should at least be able to infer that the default export of module "foo" is a function, with a parameter called "name", returning "any", right?</p>
<p dir="auto">Or, do I not understand what the following feature descriptions (quoted from the aforementioned web page) are trying to say?</p>
<blockquote>
<p dir="auto">IntelliSense<br>
The JavaScript Support uses different strategies to provide IntelliSense.</p>
<p dir="auto">IntelliSense based on type inference<br>
JavaScript uses the same inference as TypeScript to determine the type of a value.</p>
<p dir="auto">The following patterns are also recognized:</p>
<p dir="auto">"ES3-style" classes, specified using a constructor function and assignments to the prototype property.<br>
CommonJS-style module patterns, specified as property assignments on the exports object, or assignments to the module.exports property.</p>
</blockquote>
<p dir="auto">The "IntelliSense based on type inference" and "CommonJS-style module patterns" is what initially caught my eye when looking into using VS Code for my Javascript work.</p>
<p dir="auto">But, when I tried the example code shown above, in an attempt to test out both of these features, I could not get them to work even in the simplest of toy projects.</p>
<p dir="auto">Am I doing something wrong?</p>
<p dir="auto"><em>Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="150646334" data-permission-text="Title is private" data-url="https://github.com/microsoft/vscode/issues/5714" data-hovercard-type="issue" data-hovercard-url="/microsoft/vscode/issues/5714/hovercard" href="https://github.com/microsoft/vscode/issues/5714">microsoft/vscode#5714</a></em></p>
<p dir="auto"><em>From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/alexandrudima/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/alexandrudima">@alexandrudima</a> on January 27, 2016 14:48</em></p>
<p dir="auto">Testing <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="60046420" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/2218" data-hovercard-type="pull_request" data-hovercard-url="/microsoft/TypeScript/pull/2218/hovercard" href="https://github.com/microsoft/TypeScript/pull/2218">#2218</a></p>
<p dir="auto">File structure:</p>
<ul dir="auto">
<li>node_modules
<ul dir="auto">
<li>something2
<ul dir="auto">
<li>main.js</li>
<li>package.json</li>
</ul>
</li>
</ul>
</li>
<li>consumer.js</li>
</ul>
<p dir="auto"><code class="notranslate">node_modules/something2/main.js</code>:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var f = function() {
    if (true || true) {
        return 5;
    }
    return '5';
}
exports.x = f();"><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-en">f</span> <span class="pl-c1">=</span> <span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-c1">true</span> <span class="pl-c1">||</span> <span class="pl-c1">true</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">return</span> <span class="pl-c1">5</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
    <span class="pl-k">return</span> <span class="pl-s">'5'</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>
<span class="pl-s1">exports</span><span class="pl-kos">.</span><span class="pl-c1">x</span> <span class="pl-c1">=</span> <span class="pl-en">f</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><code class="notranslate">node_modules/something2/package.json</code>:</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
    &quot;name&quot;: &quot;something2&quot;,
    &quot;version&quot;: &quot;0.0.0&quot;,
    &quot;main&quot;: &quot;./main.js&quot;
}"><pre class="notranslate">{
    <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>something2<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>0.0.0<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"main"</span>: <span class="pl-s"><span class="pl-pds">"</span>./main.js<span class="pl-pds">"</span></span>
}</pre></div>
<p dir="auto"><code class="notranslate">consumer.js</code></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="var s2 = require('something2');
s2."><pre class="notranslate"><span class="pl-k">var</span> <span class="pl-s1">s2</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'something2'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">s2</span><span class="pl-kos">.</span></pre></div>
<blockquote>
<p dir="auto">Observe: <code class="notranslate">x</code> is not suggested for <code class="notranslate">s2</code></p>
</blockquote>
<p dir="auto"><em>Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="129165052" data-permission-text="Title is private" data-url="https://github.com/microsoft/vscode/issues/2459" data-hovercard-type="issue" data-hovercard-url="/microsoft/vscode/issues/2459/hovercard" href="https://github.com/microsoft/vscode/issues/2459">microsoft/vscode#2459</a></em></p>