-
Notifications
You must be signed in to change notification settings - Fork 154
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
Completion glyphs ( Bump to version 0.15.0) #1
Merged
rneatherway
merged 4 commits into
ionide:master
from
Krzysztof-Cieslak:CompletionGlyphs
May 20, 2015
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,13 @@ type Location = | |
Column: int | ||
} | ||
|
||
type CompletionResponse = | ||
{ | ||
Name: string | ||
Glyph: string | ||
GlyphChar: string | ||
} | ||
|
||
type ProjectResponse = | ||
{ | ||
Project: string | ||
|
@@ -267,6 +274,48 @@ module internal CommandInput = | |
let cmds = compilerlocation <|> outputmode <|> helptext <|> help <|> declarations <|> parse <|> project <|> completionTipOrDecl <|> quit <|> error | ||
reader |> Parsing.getFirst cmds | ||
|
||
module internal CompletionUtils = | ||
let map = | ||
[ 0x0000, ("Class", "C") | ||
0x0003, ("Enum", "E") | ||
0x00012, ("Struct", "S") | ||
0x00018, ("Struct", "S") (* value type *) | ||
0x0002, ("Delegate", "D") | ||
0x0008, ("Interface", "I") | ||
0x000e, ("Module", "N") (* module *) | ||
0x000f, ("Namespace", "N") | ||
0x000c, ("Method", "m") | ||
0x000d, ("Extension Method", "m") (* method2 ? *) | ||
0x00011, ("Property", "P") | ||
0x0005, ("Event", "e") | ||
0x0007, ("Field", "F") (* fieldblue ? *) | ||
0x0020, ("Field", "F") (* fieldyellow ? *) | ||
0x0001, ("Field", "F") (* const *) | ||
0x0004, ("Property", "P") (* enummember *) | ||
0x0006, ("Exception", "X") (* exception *) | ||
0x0009, ("Text File Icon", "t") (* TextLine *) | ||
0x000a, ("Regular File", "R") (* Script *) | ||
0x000b, ("Script", "s") (* Script2 *) | ||
0x0010, ("Tip of the day", "t") (* Formula *); | ||
0x00013, ("Class", "C") (* Template *) | ||
0x00014, ("Class", "C") (* Typedef *) | ||
0x00015, ("Type", "T") (* Type *) | ||
0x00016, ("Type", "T") (* Union *) | ||
0x00017, ("Field", "F") (* Variable *) | ||
0x00019, ("Class", "C") (* Intrinsic *) | ||
0x0001f, ("Other", "o") (* error *) | ||
0x00021, ("Other", "o") (* Misc1 *) | ||
0x0022, ("Other", "o") (* Misc2 *) | ||
0x00023, ("Other", "o") (* Misc3 *) ] |> Map.ofSeq | ||
|
||
/// Translates icon code that we get from F# language service into a MonoDevelop icon | ||
let getIcon glyph = | ||
match map.TryFind (glyph / 6), map.TryFind (glyph % 6) with | ||
| Some(s), _ -> s // Is the second number good for anything? | ||
| _, _ -> ("", "") | ||
|
||
|
||
|
||
// -------------------------------------------------------------------------------------- | ||
// Main application command-line loop | ||
// -------------------------------------------------------------------------------------- | ||
|
@@ -474,7 +523,7 @@ module internal Main = | |
match state.OutputMode with | ||
| Text -> | ||
printAgent.WriteLine "DATA: completion" | ||
for d in decls.Items do printAgent.WriteLine(d.Name) | ||
for d in decls.Items do printAgent.WriteLine(sprintf "%s" d.Name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you revert this line please? |
||
printAgent.WriteLine "<<EOF>>" | ||
main state | ||
| Json -> | ||
|
@@ -488,7 +537,9 @@ module internal Main = | |
prAsJson { Kind = "helptext"; Data = helptext } | ||
|
||
prAsJson { Kind = "completion" | ||
Data = [ for d in decls.Items do yield d.Name ] } | ||
Data = [ for d in decls.Items do | ||
let (glyph, glyphChar) = CompletionUtils.getIcon d.Glyph | ||
yield { Name = d.Name; Glyph = glyph; GlyphChar = glyphChar } ] } | ||
|
||
let helptext = | ||
Seq.fold (fun m (d: FSharpDeclarationListItem) -> Map.add d.Name d.DescriptionText m) Map.empty decls.Items | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we use upper-case for consistency?
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.
I mean 'M'