Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/fsharp/ast.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1063,12 +1063,12 @@ and
SynBindingKind *
mustInline:bool *
isMutable:bool *
SynAttributes *
attrs:SynAttributes *
xmlDoc:PreXmlDoc *
SynValData *
headPat:SynPat *
SynBindingReturnInfo option *
SynExpr *
expr:SynExpr *
range:range *
SequencePointInfoForBinding
// no member just named "Range", as that would be confusing:
Expand Down Expand Up @@ -1178,7 +1178,7 @@ and
[<NoEquality; NoComparison>]
SynEnumCase =
/// The untyped, unchecked syntax tree for one case in an enum definition.
| EnumCase of SynAttributes * ident:Ident * SynConst * PreXmlDoc * range:range
| EnumCase of attrs:SynAttributes * ident:Ident * SynConst * PreXmlDoc * range:range
member this.Range =
match this with
| EnumCase (range=m) -> m
Expand Down Expand Up @@ -1234,7 +1234,7 @@ and
[<NoEquality; NoComparison>]
/// The untyped, unchecked syntax tree for a field declaration in a record or class
SynField =
| Field of SynAttributes * isStatic:bool * Ident option * SynType * bool * xmlDoc:PreXmlDoc * accessibility:SynAccess option * range:range
| Field of attrs:SynAttributes * isStatic:bool * Ident option * SynType * bool * xmlDoc:PreXmlDoc * accessibility:SynAccess option * range:range


and
Expand Down Expand Up @@ -1344,7 +1344,7 @@ and
| Inherit of SynType * Ident option * range:range
| ValField of SynField * range:range
/// A feature that is not implemented
| NestedType of SynTypeDefn * accessibility:SynAccess option * range:range
| NestedType of typeDefn:SynTypeDefn * accessibility:SynAccess option * range:range
/// SynMemberDefn.AutoProperty (attribs,isStatic,id,tyOpt,propKind,memberFlags,xmlDoc,access,synExpr,mGetSet,mWholeAutoProp).
///
/// F# syntax: 'member val X = expr'
Expand Down
284 changes: 3 additions & 281 deletions src/fsharp/vs/ServiceAssemblyContent.fs

Large diffs are not rendered by default.

29 changes: 19 additions & 10 deletions src/fsharp/vs/ServiceDeclarations.fs
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,17 @@ module internal ItemDescriptionsImpl =
| _ ->
GetXmlCommentForItemAux None infoReader m d

let IsAttribute (infoReader: InfoReader) d =
try
let g = infoReader.g
let amap = infoReader.amap
match d with
| Item.Types(_,((TType_app(tcref,_)):: _)) ->
let ty = generalizedTyconRef tcref
Infos.ExistsHeadTypeInEntireHierarchy g amap range0 ty g.tcref_System_Attribute
| _ -> false
with _ -> false

/// Output a the description of a language item
let rec FormatItemDescriptionToToolTipElement isDecl (infoReader:InfoReader) m denv d =
let g = infoReader.g
Expand Down Expand Up @@ -1168,7 +1179,6 @@ module internal ItemDescriptionsImpl =

// Compute the index of the VS glyph shown with an item in the Intellisense menu
let GlyphOfItem(denv,d) =

/// Find the glyph for the given representation.
let reprToGlyph repr =
match repr with
Expand Down Expand Up @@ -1255,7 +1265,7 @@ module internal ItemDescriptionsImpl =

/// An intellisense declaration
[<Sealed>]
type FSharpDeclarationListItem(name, glyphMajor:GlyphMajor, glyphMinor:GlyphMinor, info) =
type FSharpDeclarationListItem(name: string, glyphMajor: GlyphMajor, glyphMinor: GlyphMinor, info, isAttribute: bool) =
let mutable descriptionTextHolder:FSharpToolTipText option = None
let mutable task = null

Expand Down Expand Up @@ -1302,18 +1312,17 @@ type FSharpDeclarationListItem(name, glyphMajor:GlyphMajor, glyphMinor:GlyphMino

member decl.Glyph = 6 * int glyphMajor + int glyphMinor
member decl.GlyphMajor = glyphMajor
member decl.GlyphMinor = glyphMinor
member decl.GlyphMinor = glyphMinor
member decl.IsAttribute = isAttribute

/// A table of declarations for Intellisense completion
[<Sealed>]
type FSharpDeclarationListInfo(declarations: FSharpDeclarationListItem[]) =

member self.Items = declarations

// Make a 'Declarations' object for a set of selected items
static member Create(infoReader:InfoReader, m, denv, items, reactor, checkAlive) =
let g = infoReader.g

let items = items |> RemoveExplicitlySuppressed g

// Sort by name. For things with the same name,
Expand Down Expand Up @@ -1363,11 +1372,11 @@ type FSharpDeclarationListInfo(declarations: FSharpDeclarationListItem[]) =
| [] -> failwith "Unexpected empty bag"
| items ->
let glyphMajor, glyphMinor = GlyphOfItem(denv,items.Head)
new FSharpDeclarationListItem(nm, glyphMajor, glyphMinor, Choice1Of2 (items, infoReader, m, denv, reactor, checkAlive)))
new FSharpDeclarationListItem(nm, glyphMajor, glyphMinor, Choice1Of2 (items, infoReader, m, denv, reactor, checkAlive), IsAttribute infoReader items.Head))

new FSharpDeclarationListInfo(Array.ofList decls)


static member Error msg = new FSharpDeclarationListInfo([| new FSharpDeclarationListItem("<Note>", GlyphMajor.Error, GlyphMinor.Normal, Choice2Of2 (FSharpToolTipText [FSharpToolTipElement.CompositionError msg])) |] )
static member Empty = new FSharpDeclarationListInfo([| |])

static member Error msg =
new FSharpDeclarationListInfo(
[| new FSharpDeclarationListItem("<Note>", GlyphMajor.Error, GlyphMinor.Normal, Choice2Of2 (FSharpToolTipText [FSharpToolTipElement.CompositionError msg]), false) |] )
static member Empty = FSharpDeclarationListInfo([| |])
3 changes: 2 additions & 1 deletion src/fsharp/vs/ServiceDeclarations.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ type internal FSharpDeclarationListItem =
member Glyph : int
member GlyphMajor : ItemDescriptionIcons.GlyphMajor
member GlyphMinor : ItemDescriptionIcons.GlyphMinor

member IsAttribute : bool

[<Sealed>]
/// Represents a set of declarations in F# source code, with information attached ready for display by an editor.
/// Returned by GetDeclarations.
Expand Down
3 changes: 1 addition & 2 deletions src/fsharp/vs/ServiceParseTreeWalk.fs
Original file line number Diff line number Diff line change
Expand Up @@ -535,5 +535,4 @@ module internal AstTraversal =
range0 // only used for asserting, does not matter in non-debug
#endif
l |> List.map (fun x -> dive x x.Range (traverseSynModuleOrNamespace [])) |> pick fileRange l
| ParsedInput.SigFile _sigFile -> None

| ParsedInput.SigFile _sigFile -> None
Loading