lgolding / auto-scale Goto Github PK
View Code? Open in Web Editor NEWA Visual Studio language service for the language used to write autoscale formulas for the Microsoft Azure Batch service
License: Apache License 2.0
A Visual Studio language service for the language used to write autoscale formulas for the Microsoft Azure Batch service
License: Apache License 2.0
The language service seems to reuse the same TokenInfo
object each time it calls the Scanner
. So be sure to set the Trigger
property to TokenTriggers.None
before OR-ing in the appropriate triggers, if any, for the current token.
Failing to do this meant that the triggers were accumulated from call to call. So, for example, once a ParenClose
token was seen, all subsequent tokens had the TokenTriggers.MatchBraces
flag set. This caused the language service to do more work than it needed to (attempting to match braces after every token).
Repro:
^ = 1;\n
This should produce one error (ASF0001 (0-0): Expected a token of type Identifier, but got token "^" of type Unknown.
). But it produces an additional, spurious error (ASF0001 (7-7): Expected a token of type Identifier, but got token "" of type End.
).
This does not happen if the trailing newline is omitted, and it does not happen if the assignment statement is correct (a = 1
).
For example, this is illegal:
$ActiveTasks = 3;
(This is also illegal, but it's caught as a parse error because we only allow an identifier on the left-hand side of an assignment:
$ActiveTasks.Count = 3;
)
Rules generally only look at one kind of node. Don't call all of their Visit
methods, just the ones they override.
When a string like 1.9.0
occurs within a function argument list, for example:
a = $ActiveTasks.GetSample(1.9.0)
it gives a parse error at the second dot, which is fine. But the error message is
Expected a token of one of the types DoubleLiteral, StringLiteral, Identifier,
but got token "." of type OperatorMemberSelect.
Why would the parser expect on of those at the point where I typed the second dot?
Example: if you type a .
at the end of this line (which already has a .
at the end):
$ActiveTasks.
... it displays the member selection list for $ActiveTasks
, even though there is an intervening token.
It should only display the member selection list if the identifier is the immediately preceding token.
Count comments as white space in Lexer.SkipWhite
.
... because I labeled the constants taskcompletion
, etc., as Keyword
, and the PrimaryExpression
grammar doesn't allow Keyword
.
All the items in the Intellisense lists use icon 0. Use different icons for user-defined variables, methods, keywords (taking hints from what C# lists look like).
If you type a .
between the identifiers $ActiveTasks
and GetSample
on this line:
$ActiveTasksGetSample
you don't get a member selection list. That's because the code incorrectly considers the "preceding" identifier to be GetSample
(which has no members), rather than $ActiveTasks
(which does have members).
If you leave a method invocation unclosed, for example
a = $ActiveTasks.GetSample(1.9
the parser attempts to construct a MethodInvocationNode
with the closeParen
argument set to null
. This gives a NullReferenceException
when the argument closeParen.EndIndex
is passed to the base class ctor.
If there is no closing paren, throw a parse exception instead of trying to construct the MethodInvocationNode
.
The test methods in those classes all have the same structure.
We can't put the entire test method into a base class, because the test method is decorated with [MemberData("TestCases")]
, and Xunit insists that a member of that name exist on the base class. The best we can do is factor the bodies of the test methods into a common helper in the base class.
Translate symbol names like OpenParen into English in the messages.
Shorter and cleaner.
Example: myVar.GetSample()
is invalid. So is $NodeDeallocationOption.GetSample()
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.