Skip to content

Commit

Permalink
Merge pull request #53 from yatli/popupmenu
Browse files Browse the repository at this point in the history
Popupmenu
  • Loading branch information
Yatao Li authored Sep 3, 2019
2 parents 5bc3070 + de62461 commit 17b59dd
Show file tree
Hide file tree
Showing 66 changed files with 726 additions and 286 deletions.
Binary file added Assets/intellisense/Class_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/ColorPalette_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Constant_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Dimension_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/EnumItem_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Enumerator_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Event_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Field_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Folder_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/IntelliSenseKeyword_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Interface_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Literal_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/LocalVariable_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Method_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Module_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/NewClass_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Operator_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Property_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Reference_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Snippet_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Structure_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/TextFile_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Text_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/intellisense/Type_16x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ FVimFontBoldWeight 700
" Font debugging -- draw bounds around each glyph
FVimFontDrawBounds v:true
" UI options (all default to v:false)
FVimUIMultiGrid v:false " per-window grid system -- work in progress
FVimUIPopupMenu v:true " external popup menu
FVimUITabLine v:false " external tabline -- not implemented
FVimUICmdLine v:false " external cmdline -- not implemented
FVimUIWildMenu v:false " external wildmenu -- not implemented
FVimUIMessages v:false " external messages -- not implemented
FVimUITermColors v:false " not implemented
FVimUIHlState v:false " not implemented
" Detach from a remote session without killing the server
" If this command is executed on a standalone instance,
" the embedded process will be terminated anyway.
Expand Down
121 changes: 121 additions & 0 deletions ViewModels/CompletionItemViewModel.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
namespace FVim

open neovim.def
open log
open common
open Avalonia.Media.Imaging
open Avalonia.Platform
open Avalonia

module CompletionItemHelper =
// Taken from coc.nvim/src/languages.ts
type CompletionItemKind =
| Text //'v'],
| Method //'f'],
| Function //'f'],
| Constructor //'function' ? 'f' : labels['con' + 'structor']],
| Field //'m'],
| Variable //'v'],
| Class //'C'],
| Interface //'I'],
| Module //'M'],
| Property //'m'],
| Unit //'U'],
| Value //'v'],
| Enum //'E'],
| Keyword //'k'],
| Snippet //'S'],
| Color //'v'],
| File //'F'],
| Reference //'r'],
| Folder //'F'],
| EnumMember //'m'],
| Constant //'v'],
| Struct //'S'],
| Event //'E'],
| Operator //'O'],
| TypeParameter //'T'],
| Unknown
let CompletionItemKindIconNames = Map [
Text, "Text"
Method, "Method"
Function, "Method"
Constructor, "NewClass"
Field, "Field"
Variable, "LocalVariable"
Class, "Class"
Interface, "Interface"
Module, "Module"
Property, "Property"
Unit, "Dimension"
Value, "Literal"
Enum, "Enumerator"
Keyword, "IntelliSenseKeyword"
Snippet, "Snippet"
Color, "ColorPalette"
File, "TextFile"
Reference, "Reference"
Folder, "Folder"
EnumMember, "EnumItem"
Constant, "Constant"
Struct, "Structure"
Event, "Event"
Operator, "Operator"
TypeParameter, "Type"
Unknown, "Unknown"
]

let ParseCompletionItemKind abbr =
match _d "" abbr with
| "t" -> Text
| ":" -> Method
| "f" -> Function
| "c" -> Constructor
| "." -> Field
| "v" -> Variable
| "C" -> Class
| "I" -> Interface
| "M" -> Module
| "p" -> Property
| "U" -> Unit
| "l" -> Value
| "E" -> Enum
| "k" -> Keyword
| "s" -> Snippet
| "K" -> Color
| "F" -> File
| "r" -> Reference
| "d" -> Folder
| "m" -> EnumMember
| "0" -> Constant
| "S" -> Struct
| "e" -> Event
| "o" -> Operator
| "T" -> TypeParameter
| _ -> Unknown

let assets = AvaloniaLocator.Current.GetService<IAssetLoader>()


let CompletionItemKindIcons =
CompletionItemKindIconNames |>
Map.map (fun k name ->
if name = "Unknown" then null
else
let fname = sprintf "avares://FVim/Assets/intellisense/%s_16x.png" name
(*trace "CompleteItem" "loading intellisense icon %s" fname*)
new Bitmap(assets.Open(new System.Uri(fname))))

open CompletionItemHelper

type CompletionItemViewModel(item: CompleteItem) =
inherit ViewModelBase()
let kind = ParseCompletionItemKind item.abbr
(*do*)
(*trace "CompletionItemViewModel" "item = %A" item*)
member __.Text = item.word
member __.Menu = _d "" item.menu
member __.Info = _d "" item.info
member __.Kind = kind
member __.Icon = CompletionItemKindIcons.[kind]

Loading

0 comments on commit 17b59dd

Please sign in to comment.