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

Visual Studio 2015 shows TypeScript errors twice in Error List #4746

Closed
asgerhallas opened this issue Sep 11, 2015 · 8 comments
Closed

Visual Studio 2015 shows TypeScript errors twice in Error List #4746

asgerhallas opened this issue Sep 11, 2015 · 8 comments
Assignees
Labels
Bug A bug in TypeScript External Relates to another program, environment, or user action which we cannot control. Visual Studio Integration with Visual Studio

Comments

@asgerhallas
Copy link

Maybe this is actually an issue with Visual Studio, but when I create a typescript project and provoke a build error, I'll get the error message twice in the Error List - one time from IntelliSense and one time from the compiler.

And it looks like - when doing something similar in C# - the error messages are merged when they are identical. I do not know, if that is actually how it works, but it would explain the behavior, because the message from the TypeScript compiler is prefixed with "Build: " and for some strange reason the error code does not show up in the the list either, so the messages are not identical.

image

If that's not the case, the question remains: why are errors shown twice for TypeScript, but not for C#? :)

@mhegazy mhegazy added the Question An issue which isn't directly actionable in code label Sep 11, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Sep 11, 2015

One set of errors are your build errors, prefixed by "Build", the other ones are your language service errors, i.e. you are editing a file and you get an immediate feedback.

build errors are just marshaled from MSBuild output, and can contain other errors as well, e.g. post build steps, other tools in the build pipeline, e.g. bundling/publishing to a website.. etc..

why you do not see these for C#? C# has a project system implementation, i.e. in a C# file can only exist in a .csproj, and the csproj knows everything it needs to know about how this file is built. For TypeScript, we wanted it to be hosted in any project kind, so we do not control how things are built. it is up to you, your project, and your build system to decide. this means you can have different errors from build that the language service did not know about at design time.

@asgerhallas
Copy link
Author

@mhegazy thank you for the clarification and sorry for the late reply here! After rereading my question, I don't think it gets my point through. What I am trying to do, is replacing the VsTsc task in (a copy of) Microsoft.TypeScript.targets so that I can compile using my gulp script (with inspiration from here #2294).

When I was doing that, I noticed that the error code is not shown for the build errors - and the same is true for errors from the original VsTsc task. So my first question was: Why is that? Can it be fixed?

The reason I want the error code on the build errors too, is that I believe I could filter out exact duplicates on the error list. But they are not exact when the code is missing in the build errors. But that was when I thought that the filtering could be done by Visual Studio. After some further experimentation today, I found that it does not work like that :)

So maybe it's not worth the trouble... I just kind of hoped I could find a method for filtering out the duplicates. Now I'm thinking something along the lines of not letting the gulp script outputting the errors that the language service has already found, but it may be far fetched.

@mhegazy
Copy link
Contributor

mhegazy commented Sep 14, 2015

Do you append any thing to the error message you get from gulp? what is the format of your error message?
VS will parse the output of the build looking for things that match a regexp.

@asgerhallas
Copy link
Author

They are output unaltered directly from tsc, and look like this:

C:\workspace\ep\ep.Client\src\scripts\Actions.ts(20,9): error TS2322: Type 'number' is not assignable to type 'string'.

This happens when I use the VsTsc task too and with a HTML application project template right out of the box.

@mhegazy mhegazy added Bug A bug in TypeScript Visual Studio Integration with Visual Studio and removed Question An issue which isn't directly actionable in code labels Sep 15, 2015
@mhegazy mhegazy added this to the TypeScript 1.7 milestone Sep 15, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Sep 15, 2015

looks like a bug in the task then. @paulvanbrenk can you take a look.

@paulvanbrenk
Copy link
Contributor

I don't think we do anything wrong here, talking to the owners of the error list.

@paulvanbrenk paulvanbrenk added the External Relates to another program, environment, or user action which we cannot control. label Oct 27, 2015
@paulvanbrenk
Copy link
Contributor

This is by design, once msbuild migrates to the new error list API this should improve. Until then there's nothing TypeScript can do here.

@paulvanbrenk paulvanbrenk removed this from the TypeScript 1.8 milestone Dec 1, 2015
@mhegazy mhegazy closed this as completed Dec 1, 2015
@mhegazy mhegazy added this to the TypeScript 1.8 milestone Dec 1, 2015
@asgerhallas
Copy link
Author

@paulvanbrenk @mhegazy thank you for looking into it!

@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 External Relates to another program, environment, or user action which we cannot control. Visual Studio Integration with Visual Studio
Projects
None yet
Development

No branches or pull requests

3 participants