-
Notifications
You must be signed in to change notification settings - Fork 676
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
Added test framework and a couple of tests for for syntax highlighting #742
Added test framework and a couple of tests for for syntax highlighting #742
Conversation
aab00d6
to
559c606
Compare
This is very cool @ivanz! That said, I'm not thrilled that "npm install" will require several prerequisites to run to completion with this change. Could you document these? FWIW, we should consider the existing Roslyn colorizer tests here: https://github.com/dotnet/roslyn/tree/master/src/EditorFeatures/CSharpTest/Classification. I'm not sure how many we could get working properly with regex-based colorizer, but there's certainly some good tests to start from. |
I had to do the following to get
After that, I could successfully do the following:
|
Thanks for haivng a look at this. I forgot that those steps are needed, because I already had the VS C++ compiler and Python installed on my machine (I can't recall having ever had to install the windows build tools package that you mention). 😞 It's not great to have to go through those extra hoops on Windows indeed. Maybe we can add the I am on holiday and will be back in ~2 weeks when I will look at this again. |
Hi, I am back from holiday. I should probably make the windows node build tools package a At this point I am not willing personally to invest time in trying to port the Roslyn semantic-highlighting tests to TypeScript. The way I was thinking about this is that a good short-term win can be adding some tests for the most common regressions (things to do with method signatures seem to be one for example) rather than try to build out a full-blown test suit. Given that the grammar is becoming more and more complex (especially more so with the upcoming C# 7 features) it will be worth probably adding some tests for those in the future. It's unfortunate that we don't even have a finger in the air estimation of when they will add the semantic highlighting api (microsoft/vscode#585 ) to know how much effort to put into this. |
All of that makes great sense to me @ivanz. I agree that moving the Roslyn semantic-highlighting tests to TypeScript would be wasted effort. I just wanted to point that there's a wealth of expectations about how C# expects to colorize code in those tests, and the syntax-based tests are separate from the semantic-based tests. |
…et and will see an error when installing the vscode-textmate regex dependency.
559c606
to
db0b2a3
Compare
Rebased and added info in README |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking pretty good. Did you want to add the peerDependency?
@@ -32,7 +32,6 @@ export default class OmniSharpCodeLensProvider extends AbstractSupport implement | |||
}; | |||
|
|||
provideCodeLenses(document: TextDocument, token: CancellationToken): CodeLens[] | Thenable<CodeLens[]> { | |||
let request = { Filename: document.fileName }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄
Sorry - forgot to say that I did not end up adding it, because I thought that non-Windows devs will start getting a warning about a Windows-specific thing. Thoughts? |
Yeah, I agree. |
Let's do it. |
Closes #696
The idea here was to wrap
vscode-textmate
in an easy to consume interface and expose a quick way to check if certain token was picked up correctly at a certain line and column number in a given input.Had to update travis.yml to handle node native dependencies (vscode-textmate pulls in a native regex lib) and also added chai.js and its definitions.
Example
A minimal example looks like this:
To add a new token type
tokenizer.ts
needs to be updated with the token details (this avoids hardcoding token id strings across tests and doing string operations):Unrelated note: It would be great to re-visit the typings story when TypeScript 2.0 comes out with the
@typings/*
npm support, because having to manually version typings and store them in a directory is less than ideal in the long run. Given TS 2.0 is round the corner there is also probably no point investing time in using something like thetypings
ortsd
tools. Just my 2c :)