Code Monkey home page Code Monkey logo

Comments (11)

zw963 avatar zw963 commented on July 28, 2024 1

@ericdallo , BTW, i don't know if flutter linux desktop if works on your's NixOS, for recent days, i found our project start to working on linux desktop, use linux desktop with lsp-dart, give me a much better experience then android emulator too, so, if you never try it, pleave give a try, it even more better then hover on some aspects, e.g. chinese input method support.

from hover.el.

ericdallo avatar ericdallo commented on July 28, 2024

hum, we do have a map for hover to add custom keybindings hover-mode-map, doesn't that would be enough?
for example we already have this at the code:

(define-key hover-mode-map (kbd "C-x q") #'hover-kill)

from hover.el.

zw963 avatar zw963 commented on July 28, 2024

hum, we do have a map for hover to add custom keybindings hover-mode-map, doesn't that would be enough? for example we already have this at the code:

(define-key hover-mode-map (kbd "C-x q") #'hover-kill)

So, maybe i misunderstood somethings, hover-mode-map, is for hover-mode, right? it for the buffer of running hover, not for dart file which i am editing? what i want is, i can always run hover-hot-reload-or-restart use C-M-x after i edit done on current dart file, and, cursor not leave dart-mode buffer, sure, i expect i can always disable those keybinding if i want to use lsp-dart-hot-reload if i disable this minor-mode. (we assume binding latter into global binding or dart-mode-key-map, i can override it to use hover when i enable hover-minor-mode)

Anyway, because hover not support Chinese character, i have to switch to and back ...

from hover.el.

ericdallo avatar ericdallo commented on July 28, 2024

Well, you can define your own bindings in any map you want, like dart-mode-map for example.
I don't see why we would create a empty hover-minor-mode just for people adding binding which they can already to dart-mode-map.

from hover.el.

zw963 avatar zw963 commented on July 28, 2024

I don't see why we would create a empty hover-minor-mode just for people adding binding which they can already to dart-mode-map.

The reason is, i want to use same keybinding when work with lsp-dart or hover.

please check my config:

;; for lsp-dart

(require 'dart-mode)
(add-to-list 'auto-mode-alist '("\\.dart\\'" . dart-mode))

(with-eval-after-load 'lsp-mode
  (setq lsp-signature-auto-activate nil)
  ;; (setq lsp-dart-dap-flutter-hot-reload-on-save t)
  (define-key dart-mode-map (kbd "C-M-x") 'lsp-dart-dap-flutter-hot-reload)
  (define-key dart-mode-map (kbd "<escape>") 'lsp-dart-show-flutter-outline)
  (add-hook 'dart-mode-hook 'lsp)
  )

;; for hover

;; (require 'hover)

(with-eval-after-load 'hover
  (define-key dart-mode-map (kbd "C-M-x") 'hover-run-or-hot-restart)
  (define-key hover-mode-map (kbd "C-M-x") 'hover-run-or-hot-reload)

  (setq
   hover-screenshot-path (concat (getenv "HOME") "/Pictures")
   hover-screenshot-prefix "magpie-"
   hover-observatory-uri "http://127.0.0.1:50300"
   hover-clear-buffer-on-hot-restart t
   hover-hot-reload-on-save t
        )
  )

you can see in my config, both lsp-dart-dap-flutter-hot-reload and hover-run-or-hot-restart defined on dart-mode-map, and when i want to use former, i have to comment (require 'hover) out, then restart my entire emacs.

sure i can define use different keybinding for hover restart and lsp-dart reload, but that not good, because they do almost same things, right?

if we have hover-minor-mode like this:

(defvar hover-minor-mode-map
  (let ((map (make-sparse-keymap)))
  (define-key map (kbd "C-M-x") 'hover-run-or-hot-restart)
    map)
  "Keymap for function `hover-minor-mode'.")

;;;###autoload
(define-minor-mode hover-minor-mode
  "add keybinding."
  :lighter " hover"
  :keymap hover-minor-mode-map
  :group 'hover)

When i enable this minor mode, i can use C-M-x to restart hover, when i disable it, i can use old dart-mode-map defined command to reload too.

user can always select disable or enable this minor mode when starting emacs use config.

from hover.el.

ericdallo avatar ericdallo commented on July 28, 2024

Alright, my point is that we would create a empty minor-mode on hover that does nothing (the define-key or yours makes sense for you but not for everyone), it seems you can already solve that with the code you provided in your config right?

from hover.el.

zw963 avatar zw963 commented on July 28, 2024

Alright, my point is that we would create a empty minor-mode on hover that does nothing (the define-key or yours makes sense for you but not for everyone), it seems you can already solve that with the code you provided in your config right?

Yes, anyway, i expected to write less code in my config. i consider this is a quite usual way to resolve this issue, it very suitable for current case, you can add the default binding of yours as hover-minor-mode default keybinding, that fine, because i can always rebinding/unbinding it, even, let user to enable this minor mode (set minor mode disable as default)

from hover.el.

ericdallo avatar ericdallo commented on July 28, 2024

yeah, anyway, I think we can have this common minor mode on hover.el for users tweak as well, sounds ok to me

from hover.el.

zw963 avatar zw963 commented on July 28, 2024

yeah, anyway, I think we can have this common minor mode on hover.el for users tweak as well, sounds ok to me

Okay, thank you, we need improve README.md too for mention it, i can contribute a PR for this, but mostly, my bad english need tweak a lot i guess, so, please do it. 😄

from hover.el.

zw963 avatar zw963 commented on July 28, 2024

I create a PR for this, please check

https://github.com/ericdallo/hover.el/pull/13/files

from hover.el.

ericdallo avatar ericdallo commented on July 28, 2024

Makes sense @zw963, we use at work because of complex plugins setups, but it should work as well the flutter desktop, thanks for the info

from hover.el.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.