Header menu logo fantomas

PrettyNaming Module

Some general F# utilities for mangling / unmangling / manipulating names. Anything to do with special names of identifiers and other lexical rules

Types and nested modules

Type/Module Description

CustomOperations

ActivePatternInfo

InvalidMangledStaticArg

NameArityPair

Functions and values

Function or value Description

ActivePatternInfoOfValName nm m

Full Usage: ActivePatternInfoOfValName nm m

Parameters:
Returns: ActivePatternInfo option
nm : string
m : range
Returns: ActivePatternInfo option

ChopPropertyName s

Full Usage: ChopPropertyName s

Parameters:
    s : string

Returns: string

Try to chop "get_" or "set_" from a string. If the string does not start with "get_" or "set_", this function raises an exception.

s : string
Returns: string

CompileOpName op

Full Usage: CompileOpName op

Parameters:
    op : string

Returns: string
 Converts the core of an operator name into a logical name. For example,
    +  --> op_Addition
    !%  --> op_DereferencePercent
 Only used on actual operator names
op : string
Returns: string

CompilerGeneratedName nm

Full Usage: CompilerGeneratedName nm

Parameters:
    nm : string

Returns: string
nm : string
Returns: string

CompilerGeneratedNameSuffix basicName suffix

Full Usage: CompilerGeneratedNameSuffix basicName suffix

Parameters:
    basicName : string
    suffix : string

Returns: string
basicName : string
suffix : string
Returns: string

ComputeMangledNameWithoutDefaultArgValues (nm, staticArgs, defaultArgValues)

Full Usage: ComputeMangledNameWithoutDefaultArgValues (nm, staticArgs, defaultArgValues)

Parameters:
    nm : string
    staticArgs : 'a[]
    defaultArgValues : (string * string option)[]

Returns: string

Mangle the static parameters for a provided type or method

nm : string
staticArgs : 'a[]
defaultArgValues : (string * string option)[]
Returns: string

ConvertLogicalNameToDisplayLayout nonOpLayout name

Full Usage: ConvertLogicalNameToDisplayLayout nonOpLayout name

Parameters:
    nonOpLayout : string -> Layout
    name : string

Returns: Layout

Like ConvertLogicalNameToDisplayName but produces a tagged layout

nonOpLayout : string -> Layout
name : string
Returns: Layout

ConvertLogicalNameToDisplayName name

Full Usage: ConvertLogicalNameToDisplayName name

Parameters:
    name : string

Returns: string
 Take a core display name (e.g. "List" or "Strange module name") and convert it to display text
 by adding backticks if necessary.
     Foo                   --> Foo
     +                     --> ``+``
     A-B                   --> ``A-B``
name : string
Returns: string

ConvertValLogicalNameToDisplayLayout isBaseVal nonOpLayout name

Full Usage: ConvertValLogicalNameToDisplayLayout isBaseVal nonOpLayout name

Parameters:
    isBaseVal : bool
    nonOpLayout : string -> Layout
    name : string

Returns: Layout

Like ConvertValLogicalNameToDisplayName but produces a tagged layout

isBaseVal : bool
nonOpLayout : string -> Layout
name : string
Returns: Layout

ConvertValLogicalNameToDisplayName isBaseVal name

Full Usage: ConvertValLogicalNameToDisplayName isBaseVal name

Parameters:
    isBaseVal : bool
    name : string

Returns: string
 Take a core display name for a value (e.g. op_Addition or PropertyName) and convert it to display text
     Foo                   --> Foo
     +                     --> ``+``
     op_Addition           --> (+)
     op_Multiply           --> ( * )
     op_DereferencePercent --> (!%)
     A-B                   --> ``A-B``
     |A|_|                 --> (|A|_|)
     let                   --> ``let``
     type                  --> ``type``
     params                --> ``params``
     base                  --> base
     or                    --> or
     mod                   --> mod
isBaseVal : bool
name : string
Returns: string

ConvertValLogicalNameToDisplayNameCore opName

Full Usage: ConvertValLogicalNameToDisplayNameCore opName

Parameters:
    opName : string

Returns: string
 Converts the logical name for and operator back into the core of a display name. For example:
     Foo                   --> Foo
     +                     --> +
     op_Addition           --> +
     op_DereferencePercent --> !%
     A-B                   --> A-B
     |A|_|                 --> |A|_|
     base                  --> base        regardless of IsBaseVal
 Used on names of all kinds

 TODO: We should assess uses of this function.

 In any cases it is used it probably indicates that text is being
 generated which:
    1. does not contain double-backticks for non-identifiers
    2. does not put parentheses arounf operators or active pattern names

 If the text is immediately in quotes, this is generally ok, e.g.

         error FS0038: '+' is bound twice in this pattern
         error FS0038: '|A|_|' is bound twice in this pattern
         error FS0038: 'a a' is bound twice in this pattern

 If not, the it is likely this should be replaced by ConvertValLogicalNameToDisplayName.
opName : string
Returns: string

DecodeGenericTypeName mangledName

Full Usage: DecodeGenericTypeName mangledName

Parameters:
    mangledName : string

Returns: NameArityPair
mangledName : string
Returns: NameArityPair

DecodeGenericTypeNameWithPos pos mangledName

Full Usage: DecodeGenericTypeNameWithPos pos mangledName

Parameters:
    pos : int
    mangledName : string

Returns: NameArityPair
pos : int
mangledName : string
Returns: NameArityPair

DemangleGenericTypeName mangledName

Full Usage: DemangleGenericTypeName mangledName

Parameters:
    mangledName : string

Returns: string
mangledName : string
Returns: string

DemangleGenericTypeNameWithPos pos mangledName

Full Usage: DemangleGenericTypeNameWithPos pos mangledName

Parameters:
    pos : int
    mangledName : string

Returns: string
pos : int
mangledName : string
Returns: string

DemangleProvidedTypeName typeLogicalName

Full Usage: DemangleProvidedTypeName typeLogicalName

Parameters:
    typeLogicalName : string

Returns: string * (string * string)[]
typeLogicalName : string
Returns: string * (string * string)[]

DoesIdentifierNeedBackticks arg1

Full Usage: DoesIdentifierNeedBackticks arg1

Parameters:
    arg0 : string

Returns: bool
arg0 : string
Returns: bool

ExtraWitnessMethodName nm

Full Usage: ExtraWitnessMethodName nm

Parameters:
    nm : string

Returns: string
nm : string
Returns: string

FSharpModuleSuffix

Full Usage: FSharpModuleSuffix

Returns: string
Returns: string

FSharpOptimizationCompressedDataResourceName

Full Usage: FSharpOptimizationCompressedDataResourceName

Returns: string
Returns: string

FSharpOptimizationDataResourceName

Full Usage: FSharpOptimizationDataResourceName

Returns: string
Returns: string

FSharpOptimizationDataResourceName2

Full Usage: FSharpOptimizationDataResourceName2

Returns: string
Returns: string

FSharpSignatureCompressedDataResourceName

Full Usage: FSharpSignatureCompressedDataResourceName

Returns: string
Returns: string

FSharpSignatureDataResourceName

Full Usage: FSharpSignatureDataResourceName

Returns: string
Returns: string

FSharpSignatureDataResourceName2

Full Usage: FSharpSignatureDataResourceName2

Returns: string
Returns: string

FSharpSignatureDataResourceName2

Full Usage: FSharpSignatureDataResourceName2

Returns: string
Returns: string

FormatAndOtherOverloadsString arg1

Full Usage: FormatAndOtherOverloadsString arg1

Parameters:
    arg0 : int

Returns: string
arg0 : int
Returns: string

FsiDynamicModulePrefix

Full Usage: FsiDynamicModulePrefix

Returns: string

The prefix of the names used for the fake namespace path added to all dynamic code entries in FSI.EXE

Returns: string

GetBasicNameOfPossibleCompilerGeneratedName name

Full Usage: GetBasicNameOfPossibleCompilerGeneratedName name

Parameters:
    name : string

Returns: string
name : string
Returns: string

GetLongNameFromString arg1

Full Usage: GetLongNameFromString arg1

Parameters:
    arg0 : string

Returns: string list
arg0 : string
Returns: string list

IllegalCharactersInTypeAndNamespaceNames

Full Usage: IllegalCharactersInTypeAndNamespaceNames

Returns: char[]
Returns: char[]

IsActivePatternName name

Full Usage: IsActivePatternName name

Parameters:
    name : string

Returns: bool
 Determines if the specified name is a valid name for an active pattern.
     |A|_|        --> true
     |A|B|        --> true
     |A|          --> true
     |            --> false
     ||           --> false
     op_Addition  --> false

 TBD: needs unit testing
name : string
Returns: bool

IsCompilerGeneratedName nm

Full Usage: IsCompilerGeneratedName nm

Parameters:
    nm : string

Returns: bool
nm : string
Returns: bool

IsIdentifierFirstCharacter c

Full Usage: IsIdentifierFirstCharacter c

Parameters:
    c : char

Returns: bool

The characters that are allowed to be the first character of an identifier.

c : char
Returns: bool

IsIdentifierName name

Full Usage: IsIdentifierName name

Parameters:
    name : string

Returns: bool
 Is the name a valid F# identifier, primarily used internally in PrettyNaming.fs for determining if an
 identifier needs backticks.

 In general do not use this routine. It is only used in one quick fix, for determining if it is valid
 to add "_" in front of an identifier.

     A            --> true
     A'           --> true
     _A           --> true
     A0           --> true
     |A|B|        --> false
     op_Addition  --> true
     +            --> false
     let          --> false
     base         --> false

 TBD: needs unit testing
name : string
Returns: bool

IsIdentifierPartCharacter c

Full Usage: IsIdentifierPartCharacter c

Parameters:
    c : char

Returns: bool

The characters that are allowed to be in an identifier.

c : char
Returns: bool

IsLogicalInfixOpName logicalName

Full Usage: IsLogicalInfixOpName logicalName

Parameters:
    logicalName : string

Returns: bool
logicalName : string
Returns: bool

IsLogicalOpName logicalName

Full Usage: IsLogicalOpName logicalName

Parameters:
    logicalName : string

Returns: bool
 Is the name a logical operator name, including unary, binary and ternary operators
    op_UnaryPlus         - yes
    op_Addition          - yes
    op_Range             - yes (?)
    op_RangeStep         - yes (?)
    op_DynamicAssignment - yes
    op_Quack             - no
    +                    - no
    ABC                  - no
    ABC DEF              - no
    base                 - no
    |A|_|                - no
logicalName : string
Returns: bool

IsLogicalPrefixOperator logicalName

Full Usage: IsLogicalPrefixOperator logicalName

Parameters:
    logicalName : string

Returns: bool
logicalName : string
Returns: bool

IsLogicalTernaryOperator logicalName

Full Usage: IsLogicalTernaryOperator logicalName

Parameters:
    logicalName : string

Returns: bool
logicalName : string
Returns: bool

IsLongIdentifierPartCharacter c

Full Usage: IsLongIdentifierPartCharacter c

Parameters:
    c : char

Returns: bool

Is this character a part of a long identifier?

c : char
Returns: bool

IsOperatorDisplayName name

Full Usage: IsOperatorDisplayName name

Parameters:
    name : string

Returns: bool
 Returns `true` if given string is an operator display name, e.g.
    ( |>> )
    |>>
    ..
name : string
Returns: bool

IsPunctuation s

Full Usage: IsPunctuation s

Parameters:
    s : string

Returns: bool
s : string
Returns: bool

IsValidPrefixOperatorDefinitionName s

Full Usage: IsValidPrefixOperatorDefinitionName s

Parameters:
    s : string

Returns: bool
s : string
Returns: bool

IsValidPrefixOperatorUse s

Full Usage: IsValidPrefixOperatorUse s

Parameters:
    s : string

Returns: bool
s : string
Returns: bool

MangleProvidedTypeName (typeLogicalName, nonDefaultArgs)

Full Usage: MangleProvidedTypeName (typeLogicalName, nonDefaultArgs)

Parameters:
    typeLogicalName : string
    nonDefaultArgs : (string * string)[]

Returns: string

Mangle the static parameters for a provided type or method

typeLogicalName : string
nonDefaultArgs : (string * string)[]
Returns: string

MangledGlobalName

Full Usage: MangledGlobalName

Returns: string
Returns: string

NormalizeIdentifierBackticks name

Full Usage: NormalizeIdentifierBackticks name

Parameters:
    name : string

Returns: string
 Adds double backticks if necessary to make a valid identifier, e.g.
     op_Addition  -->  op_Addition
     +            -->  ``+``    (this is not op_Addition)
     |>>          -->  ``|>>``  (this is not an op_)
     A-B          -->  ``A-B``
     AB           -->  AB
     |A|_|        -->  |A|_|    this is an active pattern name, needs parens not backticks
 Removes double backticks if not necessary to make a valid identifier, e.g.
     ``A``        --> A
     ``A-B``      --> ``A-B``
name : string
Returns: string

SplitNamesForILPath s

Full Usage: SplitNamesForILPath s

Parameters:
    s : string

Returns: string list
s : string
Returns: string list

TryChopPropertyName s

Full Usage: TryChopPropertyName s

Parameters:
    s : string

Returns: string option

Try to chop "get_" or "set_" from a string

s : string
Returns: string option

TryDemangleGenericNameAndPos n

Full Usage: TryDemangleGenericNameAndPos n

Parameters:
    n : string

Returns: int voption
n : string
Returns: int voption

isTildeOnlyString s

Full Usage: isTildeOnlyString s

Parameters:
    s : string

Returns: bool
s : string
Returns: bool

keywordsWithDescription

Full Usage: keywordsWithDescription

Returns: (string * string) list

Keywords paired with their descriptions. Used in completion and quick info.

Returns: (string * string) list

mkExceptionFieldName

Full Usage: mkExceptionFieldName

Returns: int -> string

Reuses generated exception field name objects for common field numbers

Returns: int -> string

mkUnionCaseFieldName

Full Usage: mkUnionCaseFieldName

Returns: int -> int -> string

Reuses generated union case field name objects for common field numbers

Returns: int -> int -> string

opNameCons

Full Usage: opNameCons

Returns: string
Returns: string

opNameEquals

Full Usage: opNameEquals

Returns: string
Returns: string

opNameEqualsNullable

Full Usage: opNameEqualsNullable

Returns: string
Returns: string

opNameNil

Full Usage: opNameNil

Returns: string
Returns: string

opNameNullableEquals

Full Usage: opNameNullableEquals

Returns: string
Returns: string

opNameNullableEqualsNullable

Full Usage: opNameNullableEqualsNullable

Returns: string
Returns: string

opNamePrefix

Full Usage: opNamePrefix

Returns: string

Prefix for compiled (mangled) operator names.

Returns: string

outArgCompilerGeneratedName

Full Usage: outArgCompilerGeneratedName

Returns: string
Returns: string

parenGet

Full Usage: parenGet

Returns: string
Returns: string

parenSet

Full Usage: parenSet

Returns: string
Returns: string

qmark

Full Usage: qmark

Returns: string
Returns: string

qmarkSet

Full Usage: qmarkSet

Returns: string
Returns: string

stackVarPrefix

Full Usage: stackVarPrefix

Returns: string
Returns: string

suffixForTupleElementAssignmentTarget

Full Usage: suffixForTupleElementAssignmentTarget

Returns: string

Indicates a ValRef generated to facilitate tuple eliminations

Returns: string

suffixForVariablesThatMayNotBeEliminated

Full Usage: suffixForVariablesThatMayNotBeEliminated

Returns: string

Mark some variables (the ones we introduce via abstractBigTargets) as don't-eliminate

Returns: string

unassignedTyparName

Full Usage: unassignedTyparName

Returns: string
Returns: string

Active patterns

Active pattern Description

(|Control|Equality|Relational|Indexer|FixedTypes|Other|) opName

Full Usage: (|Control|Equality|Relational|Indexer|FixedTypes|Other|) opName

Parameters:
    opName : string

Returns: Choice<unit, unit, unit, unit, unit, unit>
opName : string
Returns: Choice<unit, unit, unit, unit, unit, unit>

Type something to start searching.