theniceboy / coc-flutter-tools

Rich Flutter development experience for (Neo)vim
64 stars 5 forks source link

Outline improvements (toggle, size) #3

Open unknowledgeable opened 4 years ago

unknowledgeable commented 4 years ago

I've now set up a mapping for the flutter.outline command and I think it would be great if you could toggle it on and off with the same mapping as coc-explorer can (I know I keep going on about coc-explorer it but it seems like a very similar type of window right?).

Another thing I've noticed is that the widget window doesn't keep it's original size when other window splits are made/removed. Would be nice to have it stay at a defined size much like you can with coc-explorer (again!) when you set

  "explorer.width": 40,

in coc-settings.json

Also, don't know if you use which-key but I've started populating my config file with some mappings if that's of any interest to you:

let g:which_key_map.f = {
      \ 'name' : '+flutter' ,
      \ ';' : [':CocList --input=flutter commands'   , 'commands'],
      \ 'a' : [':CocCommand flutter.attach'             , 'attach'],
      \ 'A' : [':CocCommand flutter.dev.detach'         , 'detach'],
      \ 'c' : [':CocCommand flutter.create'             , 'create'],
      \ 'd' : [':CocCommand flutter.devices'            , 'devices'],
      \ 'D' : [':CocCommand flutter.doctor'             , 'doctor'],
      \ 'e' : [':CocCommand flutter.emulators'          , 'emulators'],
      \ 'i' : [':CocCommand flutter.dev.showWidgetInspectorOverride'          , 'widget inspector'],
      \ 'h' : [':CocCommand flutter.dev.hotReload'      , 'hot reload'],
      \ 'H' : [':CocCommand flutter.dev.hotRestart'     , 'hot restart'],
      \ 'l' : [':CocCommand flutter.dev.openDevLog'     , 'dev log'],
      \ 'o' : [':CocCommand flutter.outline'            , 'widget outline'],
      \ 'pg' : [':CocCommand flutter.pub.get'            , 'pub get'],
      \ 'p' : [':CocCommand flutter.dev.debugPaintSizeEnabled'            , 'paint lines'],
      \ 'P' : [':CocCommand flutter.dev.showPerformanceOverlay'           , 'performance'],
      \ 'q' : [':CocCommand flutter.dev.quit'           , 'quit server'],
      \ 'r' : [':CocCommand flutter.run'                , 'run'],
      \ 's' : [':CocCommand flutter.gotoSuper'          , 'go to super'],
      \ 'S' : [':CocCommand flutter.dev.screenshot'     , 'screen shot'],
      \ 't' : [':CocCommand flutter.dev.openProfiler'   , 'DevTools'],
      \ 'T' : [':CocCommand flutter.dev.defaultTargetPlatform'   , 'target platform'],
      \ 'U' : [':CocCommand flutter.upgrade'            , 'upgrade'],
      \ }

I've left most of the debug stuff out because I think I want to nest it but it's a start!

theniceboy commented 4 years ago

I've added the flutter.toggleOutline command and the flutter.outlineWidth setting. I think these solve the problem.

unknowledgeable commented 4 years ago

I know vim is generally a mouse free zone but what if when you clicked on a node in the tree it took you to the corresponding line in the code?

Or better yet, h to fold widgets (hide children but display a ... or something), j/k for up/down and l to go to line. What do you think?

Let me know if my recommendations are getting too much haha!

E: toggle and outlinewidth are perfect btw!

theniceboy commented 4 years ago

@unknowledgeable Now you can press "enter" in the outline buffer to go to the corresponding location in the source file.

theniceboy commented 4 years ago

Regarding folding, I do think that folding is really useful, but I'm yet to figure out a fast way to persist the outline tree folding state when a new outline tree gets passed from the language server. I'll have to keep experimenting.

unknowledgeable commented 4 years ago

Awesome! Do you want me to continue with the suggestions as I think of them?

theniceboy commented 4 years ago

Yes, please! I might not implement all of them as quickly but I’ll work on them when I have time. I’ll also be posting stuff that I think might be useful in github issues so feel free to discuss in those.