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

TSServer: config file diagnostics are missing start / end property #10384

Closed
dbaeumer opened this issue Aug 17, 2016 · 7 comments
Closed

TSServer: config file diagnostics are missing start / end property #10384

dbaeumer opened this issue Aug 17, 2016 · 7 comments
Assignees
Labels
Fixed A PR has been merged for this issue Help Wanted You can do this Suggestion An idea for TypeScript VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone

Comments

@dbaeumer
Copy link
Member

TypeScript Version: 2.0
Code
tsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "abdb": 10
    }
}
  • open a file that triggers validating the tsconfig.json file
  • the event returned from the tsserver is missing start and end properties on the diagnostic literals. You get:
Event received: configFileDiag (0).
Data: {
    "triggerFile": "p:/mseng/VSCode/Playgrounds/ts-2.0/test.ts",
    "configFile": "p:/mseng/VSCode/Playgrounds/ts-2.0/tsconfig.json",
    "diagnostics": [
        {
            "text": "Unknown compiler option 'abdb'."
        }
    ]
}
@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Help Wanted You can do this labels Aug 17, 2016
@RyanCavanaugh
Copy link
Member

We use a regular JSON parser to read this file so we don't actually know where the property came from. Maybe someone can find / write a span-preserving JSON parser (I've looked but haven't found one) so we can report better errors.

@mhegazy mhegazy added this to the Community milestone Aug 17, 2016
@dbaeumer
Copy link
Member Author

@RyanCavanaugh: makes the feature not very useful when used inside editors since we would need to fold all errors onto the file without being able to provide error indications.

In addition it violates the tsserver protocol spec which states that start/end are mandatory on a Diagnostic object.

Could this be upgraded to a bug and consider for 2.0. Being able to show errors on tsconfig files is a long wanted feature.

We maintain a json parser here: https://github.com/Microsoft/node-jsonc-parser. Even supports comments.

@dbaeumer
Copy link
Member Author

@mhegazy @DanielRosenwasser FYI.

@RyanCavanaugh
Copy link
Member

Related work happening in #10418

@waderyan waderyan added the VS Code Tracked There is a VS Code equivalent to this issue label Sep 14, 2016
@mjbvz
Copy link
Contributor

mjbvz commented Feb 13, 2017

@@mhegazy We've enabled config file diagnostics in VSCode but had to resort to a pretty ugly workaround to try to map the error to a specific location. Having proper location data on the config diagnostic responses would fix a number of edge cases and errors that I'm currently seeing

@sheetalkamat
Copy link
Member

This is fixed right?

{"seq":0,"type":"event","event":"configFileDiag","body":{"triggerFile":"c:/temp/test2/lib/file2.ts","configFile":"c:/temp/test2/lib/tsconfig.json","diagnostics":[{"start":{"line":10,"offset":9},"end":{"line":10,"offset":14},"text":"Unknown compiler option 'abv'.","code":5023,"category":"error","fileName":"c:/temp/test2/lib/tsconfig.json"}]}}

@mjbvz
Copy link
Contributor

mjbvz commented Mar 6, 2019

Yes, I confirmed that this is working properly now. I'll make sure we consume these ranges properly on the VS Code side

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed A PR has been merged for this issue Help Wanted You can do this Suggestion An idea for TypeScript VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone
Projects
None yet
Development

No branches or pull requests

6 participants