Skip to content

Code editing sequence matters for typing acquisition #11744

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

Closed
kieferrm opened this issue Oct 20, 2016 · 7 comments
Closed

Code editing sequence matters for typing acquisition #11744

kieferrm opened this issue Oct 20, 2016 · 7 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@kieferrm
Copy link
Member

OS Version: macOS
TypeScript Version: typescript@^2.0.6-insiders.20161014 using vscode 1.7 insiders

Note: "typescript.experimentalAutomaticTypeAcquisition": true must be in your vscode user settings.

Steps to Reproduce

    1. clear ~/Library/Application Support/Microsoft/TypeScript/node_modules/@types
    1. start vscode on an workspace with the following two files:
      package.json
{
    "name": "test",
    "version": "0.0.1",
    "dependencies": {
        "express" : "4.14.0"
    },
    "engines" : {
        "node" : "6.7.0",
        "npm" : "3.10.x"
    }
}

test.js

var fs = require('fs');
fs.
    1. open test.js in editor
    1. append to the file:
var calendar = require('node-calendar');
calendar.
    1. invoke inteliisense; no proposals
    1. open package.json in the editor
    1. add the following dependency
        "node-calendar" : "0.1.4"
    1. go back to test.js
    1. place caret behind calendar. and invoke intellisense using Cmd+Space

Expected behavior:
Intellisense proposals for the node-calendar module are presented

Actual behavior:
No node-calendar specific proposals are shown. ~/Library/Application Support/Microsoft/TypeScript/node_modules/@types remains unchanged.

    1. restart vscode
    1. repeat steps 8. and 9.

-> Intellisense proposals for the node-calendar module are presented

Note: When first adding the dependency for node-calendar in package.json and then adding the require in test.js auto acquisition and intellisense work as expected.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 20, 2016

Step 4 is covered by #11256.

step 9 should work even without #11256. we need to look at this.

@mhegazy mhegazy added the Bug A bug in TypeScript label Oct 20, 2016
@mhegazy mhegazy added this to the TypeScript 2.1 milestone Oct 20, 2016
@vladima
Copy link
Contributor

vladima commented Oct 20, 2016

I've tried step 9 with a minor modification - use different source file

import * as c from "node-calendar";
c.
var calendar = require('node-calendar');
calendar.

After adding entry to package.json I can see in log of typings installer that typings for node-calendar were installed and completion appear after c. but requesting completions after calendar. still shows nothing

@vladima
Copy link
Contributor

vladima commented Oct 20, 2016

at glance this is a consequence of this change - node.d.ts declares require function which prevents var calendar = require('node-calendar'); to be treated as module loading request

@vladima
Copy link
Contributor

vladima commented Oct 20, 2016

I cannot repro this issue using Ubuntu 16.04.1 LTS, TS: 2.0.6-insiders.20161017, VSCode 1.7.0 insider.
After repeating steps in description I'm getting proper intellisense. Can you please re-check it on the latest insider build to see if you still can see the issue?

@vladima
Copy link
Contributor

vladima commented Oct 20, 2016

#11752 is filed to track issue with missing completions after require

@mhegazy
Copy link
Contributor

mhegazy commented Oct 20, 2016

closing this in favor of #11256 and #11752

@mhegazy mhegazy closed this as completed Oct 20, 2016
@mhegazy mhegazy added the Duplicate An existing issue was already created label Oct 20, 2016
@vladima
Copy link
Contributor

vladima commented Oct 20, 2016

This is a different issue, will send a PR with a fix

@vladima vladima reopened this Oct 20, 2016
@vladima vladima added Fixed A PR has been merged for this issue and removed Duplicate An existing issue was already created labels Oct 21, 2016
@vladima vladima closed this as completed Oct 21, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants