Skip to content

Odd file completion for file in subdirectory returned when using compilerOptions.path #21590

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
mjbvz opened this issue Feb 2, 2018 · 0 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Feb 2, 2018

TypeScript Version: 2.7.1

Search Terms:

  • Path intellisense
  • Path completions

Code

$ git clone https://github.com/mjbvz/ts-issue-21582
  1. For a js project:
jsconfig.json
src/
  index.js
  keeper.js
  animals/
      cat.js

With jsconfig.json:

{
	"compilerOptions": {
		"module": "commonjs",
		"target": "es2016",
		"baseUrl": ".",
		"paths": {
			"@zoo/*": ["./src/*"]
		}
	},
	"exclude": [
		"node_modules",
		"**/node_modules/*"
	]
}
  1. In src/index.js, type: import {} from '@zoo/animals/'

  2. Trigger path intellisense after @zoo/animals/

Expected behavior:
Returns a file completion for `cat.

Actual behavior:
An odd completion for /cat is returned:

[Trace  - 2:30:56 PM] Response received: completions (470). Request took 4 ms. Success: true 
Result: [
    {
        "name": "/cat",
        "kind": "external module name",
        "kindModifiers": "",
        "sortText": "/cat",
        "replacementSpan": {
            "start": {
                "line": 1,
                "offset": 30
            },
            "end": {
                "line": 1,
                "offset": 30
            }
        }
    }
]

This causes the import to become '@zoo/animals//cat'

Related:
#21589
#21591

@mjbvz mjbvz changed the title Odd file completions for file in subdirectories returned when using compilerOptions.path Odd file completion for file in subdirectory returned when using compilerOptions.path Feb 2, 2018
@mhegazy mhegazy added the Bug A bug in TypeScript label Feb 2, 2018
@mhegazy mhegazy assigned ghost Feb 2, 2018
@mhegazy mhegazy added this to the TypeScript 2.7.2 milestone Feb 2, 2018
@ghost ghost added the Fixed A PR has been merged for this issue label Feb 6, 2018
@ghost ghost closed this as completed in #21688 Feb 6, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
This issue was closed.
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

2 participants