Skip to content

TypeScript language service breaks down when wrong casing is used for imports #5430

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
dbaeumer opened this issue Oct 28, 2015 · 5 comments
Closed
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@dbaeumer
Copy link
Member

Copied from: https://code.visualstudio.com/Issues/Detail/20178

I was experiencing a bizarre issue where the TS language service broke down and wouldn't underline errors in my code. After pulling my hair out for half an hour, I figured out it was because I was doing a file import with the wrong case e.g.

import Engine from "./Engine"

instead of

import Engine from "./engine"

The default class exported was named 'Engine' which I think might have also had something to do with it.

Open the attached folder in VS Code, then pick the "engine.ts" file and notice that there is an undefined symbol ("jjj_this_is_an_error") that is not red underlined.

I would expect a better error on the erroneous import instead of the imported file no longer having proper language services. :)

@mhegazy
Copy link
Contributor

mhegazy commented Oct 28, 2015

looks like #5149.

I do agree a better experience is needed here.

@mhegazy mhegazy added the Bug A bug in TypeScript label Oct 28, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Oct 28, 2015

@vladima, what can we do here?

@mhegazy mhegazy added Duplicate An existing issue was already created Bug A bug in TypeScript and removed Bug A bug in TypeScript Duplicate An existing issue was already created labels Oct 28, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Oct 28, 2015

thanks to @vladima, this is not a duplicate, this is a bug in tsserver. fix queued.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 28, 2015

The issue is that tsserver was using a case sensitive map to store files, so looking up a file with a different case did not work. this should be fixed in TS 1.7, by #5436.

Now ideally, you would want a warring if you reference a module with the wring case, for this use the new flag --forceConsistentCasingInFileNames added in #5275, to check that you always reference the same file using consistent naming this will be available in TS 1.8.

mhegazy added a commit that referenced this issue Oct 28, 2015
Fix #5430: Use FileMap to store file list in tsserver
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Oct 28, 2015
@xirzec
Copy link
Member

xirzec commented Oct 29, 2015

@mhegazy Thanks for the quick fix! 👍

@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