-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Unable navigate to file from "Errors and Warnings" when errors occur in TypeScript. #1420
Comments
@liandaoacc this works for me. Here is what I see: From the error message I think there is a setup issue telling the tsc compiler to produce errors with absolute paths. Which version of tsc are you using. And can you please run tsc from a command prompt and provide the output. |
@dbaeumer I changed the path of TEST and still got the error. Error Unable to open 'HelloWorld.ts': File not found (f:\TEST\F:\TEST\HelloWorld.ts). Create File Cancel (I failed to attach image. Github show: Something went really wrong, and we can't process that file.) I installed tsc using npm install -g typescript, here is my tsc path and tsc version.
|
@aeschli is covered by the fix you did with Dirk yesterday for 0.10.5? |
@egamma No, that fix was not related to paths. |
@liandaoacc can you provide me with the workspace that shows the problem (e.g as a public git repository). I can't reproduce this on WIndows using VSCode 0.10.6 and tsc version 1.7.5 |
@dbaeumer I tried many times in VSCode 0.10.5 and then update to 0.10.6, and finally I found how I produced this problem in both version.
and the codes in files are {
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"showOutput": "silent",
"args": ["HelloWorld.ts"],
"problemMatcher": "$tsc"
}
class Startup {
public static main(): number {
console.logg('Hello World');
return 0;
}
}
After some tries, I noticed that the VSCode showed me error message in case 1. I did not notice this before. The error message is Property 'logg' does not exist on type 'Console'. And I could click on this problem to navigate to HelloWorld.ts. Since I failed to attach image, so I will reply the email to send some error message images. |
@dbaeumer Sorry, I found I can't reply the email directly. So if you need the image, please let me know. |
@liandaoacc The different error message come from the fact that in case1 the message comes from the internal language service where the second comes from the external tsc compiler. However in both cases you should be able to navigate to the file containing the error. The problem is actual a very old version of the tsc compiler that is install on your system. tsc -V reports Version 1.0.3.0 on your system (this version reports file names as absolute paths). It should be at least 1.6.x or higher (which report file names as relative paths). I guess that a long time ago you install the tsc compiler through Visual Studio as an executable which now has preference over the npm module. In a command prompt type where tsc to validate this. I am pretty sure it will not take tsc from AppData\Roaming\npm\tsc. You can either uninstall the old version of tsc (recommended) or if you really want to use that version of the compiler tweak the tasks.json file to instruct VS Code to use absolute paths from the compiler. {
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"showOutput": "silent",
"args": ["HelloWorld.ts"],
"problemMatcher": {
"base": "$tsc",
"fileLocation": "absolute"
}
} |
I have the exact same problem with eslint: tasks.json: {
"version": "0.1.0",
"command": "npm",
"args": ["--loglevel", "silent", "run"],
"isShellCommand": true,
"showOutput": "silent",
"tasks": [
{
"taskName": "lint",
"problemMatcher": "$eslint-stylish"
}
]
} Setting the problem matcher with fileLocation: absolute works, but imo this should not be needed. I have the latest eslint version installed so $eslint-stylish should set this automatically. |
@felixfbecker this looks like a different issue. I've extracted this into a separate issue #2202 |
I followed Transpiling TypeScript into JavaScript, and got an error Unable to open 'HelloWorld.ts': File not found (e:\SoftwareProgram\Test\E:\SoftwareProgram\Test\HelloWorld.ts) in step 4 when I clicked on the problem. I report this because I think it should open HelloWorld.ts. Am I right?
My version is 0.10.3, and my OS is windows 7.
The text was updated successfully, but these errors were encountered: