Microsoft.CodeAnalysis.VisualBasic.Workspaces
Return the classification type associated with this token.
The token to be classified.
The classification type for the token
Determine if the kind represents a control keyword
Determine if the kind represents a control statement
Try use the existing syntax node and generate a new syntax node for the given .
Note: the returned syntax node might be modified, which means its parent information might be missing.
Builds up the suffix to show for something with parameters in navigate-to.
While it would be nice to just use the compiler SymbolDisplay API for this,
it would be too expensive as it requires going back to Symbols (which requires
creating compilations, etc.) in a perf sensitive area.
So, instead, we just build a reasonable suffix using the pure syntax that a
user provided. That means that if they wrote "Method(System.Int32 i)" we'll
show that as "Method(System.Int32)" Not "Method(Integer)". Given that this Is
actually what the user wrote, And it saves us from ever having to go back to
symbols/compilations, this Is well worth it, even if it does mean we have to
create our own 'symbol display' logic here.
this holds onto changes made by formatting engine.
currently it only has an ability to apply those changes to buffer. but it could be expanded to
support other cases as well such as tree or etc.
trivia factory.
it will cache some commonly used trivia to reduce memory footprint and heap allocation
represents a general trivia between two tokens. slightly more expensive than others since it
needs to calculate stuff unlike other cases
represents a general trivia between two tokens. slightly more expensive than others since it
needs to calculate stuff unlike other cases
In MemberAccessExpression Contexts, filter out event symbols (except for NameOf context), except inside AddRemoveHandler Statements
Also, filter out any implicitly declared members generated by event declaration or property declaration
Flag indicating if we should perform a rename inside string literals.
Flag indicating if we should perform a rename inside comment trivia.
A map from spans of tokens needing rename within strings or comments to an optional
set of specific sub-spans within the token span that
have matches and should be renamed.
If this sorted set is Nothing, it indicates that sub-spans to rename within the token span
are not available, and a regex match should be performed to rename
all matches within the span.
Gets the top most enclosing statement as target to call MakeExplicit on.
It's either the enclosing statement, or if this statement is inside of a lambda expression, the enclosing
statement of this lambda.
The token to get the complexification target for.
Gets the semantic model for the given node.
If the node belongs to the syntax tree of the original semantic model, then returns originalSemanticModel.
Otherwise, returns a speculative model.
The assumption for the later case is that span start position of the given node in it's syntax tree is same as
the span start of the original node in the original syntax tree.
Complexify makes inferred names explicit for tuple elements and anonymous type members. This
class considers which ones of those can be simplified (after the refactoring was done).
If the inferred name of the member matches, the explicit name (from Complexifiy) can be removed.
Returns the predefined keyword kind for a given special type.
The specialtype of this type.
The keyword kind for a given special type, or SyntaxKind.None if the type name is not a predefined type.
Note: This helper exists solely to work around Bug 1012713. Once it is fixed, this helper must be
deleted in favor of .
Context: Bug 1012713 makes it so that the compiler doesn't support PredefinedType.Member inside crefs
(i.e. System.Int32.MaxValue is supported but Integer.MaxValue isn't). Until this bug is fixed, we don't
support simplifying types names Like System.Int32.MaxValue to Integer.MaxValue.
Checks if the SyntaxNode is a name of a namespace declaration. To be a namespace name, the syntax
must be parented by an namespace declaration and the node itself must be equal to the declaration's Name
property.
Computes a list of nodes and tokens that need to be reduced in the given syntax root.
Helper class to analyze the semantic effects of a speculated syntax node replacement on the parenting nodes.
Given an expression node from a syntax tree and a new expression from a different syntax tree,
it replaces the expression with the new expression to create a speculated syntax tree.
It uses the original tree's semantic model to create a speculative semantic model and verifies that
the syntax replacement doesn't break the semantics of any parenting nodes of the original expression.
Creates a semantic analyzer for speculative syntax replacement.
Original expression to be replaced.
New expression to replace the original expression.
Semantic model of node's syntax tree.
Cancellation token.
True if semantic analysis should be skipped for the replaced node and performed starting from parent of the original and replaced nodes.
This could be the case when custom verifications are required to be done by the caller or
semantics of the replaced expression are different from the original expression.
True if semantic analysis should fail when any of the invocation expression ancestors of in original code has overload resolution failures.
Determines whether performing the syntax replacement in one of the sibling nodes of the given lambda expressions will change the lambda binding semantics.
This is done by first determining the lambda parameters whose type differs in the replaced lambda node.
For each of these parameters, we find the descendant identifier name nodes in the lambda body and check if semantics of any of the parenting nodes of these
identifier nodes have changed in the replaced lambda.
A helper class that is constructed giving a set of modifiers. It takes these modifiers, and
breaks them down into separate categories, as well as determines what type of declaration is
being forced if certain modifiers are present.
Parsed that creates with given encoding And checksum algorithm.
Given a starting or ending directive, return the matching directive, if it exists. For directives that live
the "middle" of a start/end pair, such as #ElseIf or #Else, this method will throw.
Given a conditional directive (#If, #ElseIf, #Else, or #End If), returns a IEnumerable of all directives in
the set.
Decompose a name or member access expression into its component parts.
The name or member access expression.
The qualifier (or left-hand-side) of the name expression. This may be null if there is no qualifier.
The name of the expression.
The number of generic type parameters.
Given an expression node, tries to generate an appropriate name that can be used for
that expression.
Breaks up the list of provided nodes, based on how they are
interspersed with pp directives, into groups. Within these groups
nodes can be moved around safely, without breaking any pp
constructs.
Returns true if the passed in node contains an interleaved pp
directive.
i.e. The following returns false:
void Goo() {
#if true
#endif
}
#if true
void Goo() {
}
#endif
but these return true:
#if true
void Goo() {
#endif
}
void Goo() {
#if true
}
#endif
#if true
void Goo() {
#else
}
#endif
i.e. the method returns true if it contains a PP directive that
belongs to a grouping constructs (like #if/#endif or
#region/#endregion), but the grouping construct isn't entirely c
contained within the span of the node.
Returns true if this is a block that can contain multiple executable statements. i.e.
this node is the VB equivalent of a BlockSyntax in C#.
If "node" is the begin statement of a declaration block, return that block, otherwise
return node.
Returns true if is a given token is a child token of a certain type of parent node.
The type of the parent node.
The token that we are testing.
A function that, when given the parent node, returns the child token we are interested in.
Returns true if is a given token is a separator token in a given parent list.
The type of the parent node containing the separated list.
The token that we are testing.
A function that, when given the parent node, returns the separated list.
Determines whether the given SyntaxToken is the first token on a line
check whether given token is the last token of a statement that ends with end of line trivia or an elastic trivia
check whether given token is the last token of a statement by walking up the spine
Finds the token being touched by this position. Unlike the normal FindTrivia helper, this helper will prefer
trivia to the left rather than the right if the position is on the border.
The syntaxTree to search.
The position to find trivia.
A visitor that determines if the targetToken passed in the constructor can be considered
the end of the visited statement. Tokens in the token stream of the file after
targetToken are ignored. This means that in some cases, say "Throw" vs. "Throw x" there
is more than one keyword that could terminate the statement.
We need to check for EOL trivia not preceded by LineContinuation trivia.
This is slightly complicated since we need to get TrailingTrivia from missing tokens
and then get LeadingTrivia for the next non-missing token.
Note that this is even more complicated in the case that we're in structured trivia
because we might be part of the leading trivia to the next non-missing token.
The specified position is where we can declare some .NET type, such as classes, structures, etc.
The specified position is where a keyword can go like "Sub", "Function", etc. in a classes, structures, and modules
The specified position is where a keyword can go like "Sub", "Function" in an interface
The specified position is where we can declare some .NET type, such as classes, structures, etc.
The specified position is where I could start a statement in a place where exactly one
statement could exist.
The specified position is where I could start a statement in a place where one or more
statements could exist.
The specified position is immediately following a statement of one of the given kinds.
Given a syntax node, this returns the token that is the "end" token that ends this
expression.
The expression to get the last token of.
The last token, or SyntaxKind.None if the last token is missing.
Helper structure to store some context about a position for keyword completion
True if position is after a colon, or an
EOL that was not preceded by an explicit line continuation
True if position is definitely the beginning of a new statement (after a colon
or two line breaks).
Dim q = From a In args
$1
$2
$1 may continue the previous statement, but $2 definitely starts a
new statement since there are two line breaks before it.
The specified position is immediately following a statement of one of the given kinds.
Determines whether the given IMethodSymbol can be used as an aggregate function
in a Group..By..Into or an Aggregate..Into clause.
Determine if the given array contains the given kind.
Array to search
Sought value
True if contains the value .
PERF: Not using Array.IndexOf here because it results in a call to IndexOf on the default EqualityComparer for SyntaxKind. The default comparer for SyntaxKind is
the ObjectEqualityComparer which results in boxing allocations.
Locate the given in an array starting at the given index.
Array to search
Sought value
Starting index
The index of the first occurrence of in .
PERF: Not using Array.IndexOf here because it results in a call to IndexOf on the default EqualityComparer for SyntaxKind. The default comparer for SyntaxKind is
the ObjectEqualityComparer which results in boxing allocations.
A mapping containing the simple names And arity of all namespace members, mapped to the import that
they're brought in by.
A mapping containing the simple names of all members, mapped to the import that they're brought in by.
Members are imported in through modules in vb. This doesn't keep track of arity because methods can be
called with type arguments.
A mapping containing the simple names of all extension methods, mapped to the import that they're
brought in by. This doesn't keep track of arity because methods can be called with type arguments.
Get the declaring syntax node for a Symbol. Unlike the DeclaringSyntaxReferences property,
this function always returns a block syntax, if there is one.
Only attributes, expressions or statements can be made explicit
<event>
<handler>
The expression to be evaluated and converted.
The name of the data type to which the value of expression will be converted.
<expression>
<typeName>
Associates an event with an event handler, delegate or lambda expression at run time.
The event to associate an event handler, delegate or lambda expression with.
The event handler to associate with the event. This may take the form of { AddressOf <eventHandler> | <delegate> | <lambdaExpression> }.
If <expression> evaluates to a reference or Nullable value that is not Nothing, the function returns that value. Otherwise, it calculates and returns <expressionIfNothing>.
Returned if it evaluates to a reference or nullable type that is not Nothing.
Evaluated and returned if <expression> evaluates to Nothing.
<expressionIfNothing>
Returns the result of explicitly converting an expression to a specified data type.
Introduces a type conversion operation similar to CType. The difference is that CType succeeds as long as there is a valid conversion, whereas DirectCast requires that one type inherit from or implement the other type.
The type name to return a System.Type object for.
Returns a System.Type object for the specified type name.
The XML namespace prefix to return a System.Xml.Linq.XNamespace object for. If this is omitted, the object for the default XML namespace is returned.
<xmlNamespacePrefix>
Returns the System.Xml.Linq.XNamespace object corresponding to the specified XML namespace prefix.
Replaces a specified number of characters in a String variable with characters from another string.
The name of the string variable to modify.
The one-based character position in the string where the replacement of text begins.
The number of characters to replace. If omitted, the length of <stringExpression> is used.
<stringName>
<startIndex>
<length>
<stringExpression>
Converts an expression to the {0} data type.
Removes the association between an event and an event handler or delegate at run time.
The event to disassociate an event handler or delegate from.
The event handler to disassociate from the event. This may take the form of { AddressOf <eventHandler> | <delegate> }.
If <condition> returns True, the function calculates and returns <expressionIfTrue>. Otherwise, it returns <expressionIfFalse>.
The expression to evaluate.
Evaluated and returned if <condition> evaluates to True.
Evaluated and returned if <condition> evaluates to False.
<condition>
<expressionIfTrue>
<expressionIfFalse>
Introduces a type conversion operation that does not throw an exception. If an attempted conversion fails, TryCast returns Nothing, which your program can test for.
<typeOrMember>
The type of member to return the name of.
Produces a string for the name of the specified type or member.
<result>
R&emove and Sort Imports
&Sort Imports
VB Coding Conventions
Rewrite "EndIf" to "End If" for an EndIfStatementSyntax/EndIfDirectiveSyntax node.
Syntax node for the EndIfStatementSyntax or EndIfDirectiveSyntax to be rewritten.
"End" keyword token for .
"If" keyword token for .
Rewritten EndIfStatementSyntax/EndIfDirectiveSyntax node.
This method checks for the following:
(a) Both the End keyword and If keyword, and respectively, are Missing tokens AND
(b) Descendant Trivia under the given token or token has an "EndIf" keyword token.
If the above conditions are met, it does the following node rewrites:
(a) Replace the missing and tokens with new "End" and "If" keywords tokens respectively.
(b) Remove the first "EndIf" keyword token from the descendant trivia and adjust the leading and trailing trivia appropriately.
this will put operator token and modifier tokens in right order
check whether given operator statement is valid or not
normalize operator
reorder modifiers in the list
normalize modifier list of the node and record changes if there is any change
normalize modifier list of the node and record changes if there is any change
remove "Dim" keyword if present
remove a modifier from the given node
check whether given modifiers are in right order (in sync with ModifierKindsInOrder list)
Remove this value when another is added.
Remove this value when another is added.