Code Monkey home page Code Monkey logo

hover.el's Introduction

MELPA Actions Status Codacy Badge

hover.el

Emacs tool for running flutter mobile apps on desktop using hover.

If you want to run flutter on a emulator from Emacs, you should check flutter.el.

Installation

You can install from MELPA with package.el:

M-x package-install hover

Running

hover.el helps you run the hover binary interactively as an inferior process. It's designed to work together with dart-mode. For example you can bind hover-run-or-hot-reload to C-M-z in dart-mode. While editing your Dart code, just hit C-M-z to either run your app, or if it's already running, to hot-reload it.

Configuration

Variable Description Default value
hover-command-path Path to the hover executable command tries to use hover if exists in $PATH
hover-flutter-sdk-path Path to flutter sdk path to find flutter executable command tries to find flutter executable in $PATH
hover-hot-reload-on-save On buffer save, triggers hover hot-reload (if hover is running) nil
hover-screenshot-path If non-nil, save hover screenshot on specified folder. project root
hover-screenshot-prefix Prefix for file name on hover-take-screenshot. hover-
hover-observatory-uri Hover custom observatory-uri. http://127.0.0.1:50300
hover-clear-buffer-on-hot-restart Calls hover-clear-buffer after a hover-hot-restart nil

Example

The following example uses all available configurations above, you can customize as you wish.

;; Assuming usage with dart-mode
(use-package dart-mode
  :custom
  (dart-sdk-path (concat (getenv "HOME") "/flutter/bin/cache/dark-sdk/")
   dart-format-on-save t))

(use-package hover
  :after dart-mode
  :bind (:map hover-minor-mode-map
              ("C-M-z" . #'hover-run-or-hot-reload)
              ("C-M-x" . #'hover-run-or-hot-restart)
              ("C-M-p" . #'hover-take-screenshot'))
  :init
  (setq hover-flutter-sdk-path (concat (getenv "HOME") "/flutter") ; remove if `flutter` is already in $PATH
        hover-command-path (concat (getenv "GOPATH") "/bin/hover") ; remove if `hover` is already in $PATH
        hover-hot-reload-on-save t
        hover-screenshot-path (concat (getenv "HOME") "/Pictures")
        hover-screenshot-prefix "my-prefix-"
        hover-observatory-uri "http://my-custom-host:50300"
        hover-clear-buffer-on-hot-restart t)
  (hover-minor-mode 1))

Thanks to flutter.el which inspired this project.

hover.el's People

Contributors

conao3 avatar ericdallo avatar flexv99 avatar p4v4n avatar zw963 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hover.el's Issues

Wayland support

I'm having trouble using hover.el with the pGTK wayland emacs branch. When I run hover-run the command fails with the following message:

hover: Running surf_diary in debug_unopt mode
2021/10/07 11:14:19 PlatformError: X11: Failed to open display wayland-1
panic: NotInitialized: The GLFW library is not initialized

goroutine 1 [running, locked to thread]:
github.com/go-gl/glfw/v3.3/glfw.acceptError({0x0, 0x0, 0x52d0ea})
	/home/hugh/go/pkg/mod/github.com/go-gl/glfw/v3.3/[email protected]/error.go:174 +0x186
github.com/go-gl/glfw/v3.3/glfw.panicError(...)
	/home/hugh/go/pkg/mod/github.com/go-gl/glfw/v3.3/[email protected]/error.go:185
github.com/go-gl/glfw/v3.3/glfw.WindowHint(0xc, 0x10006)
	/home/hugh/go/pkg/mod/github.com/go-gl/glfw/v3.3/[email protected]/window.go:275 +0x3f
github.com/go-flutter-desktop/go-flutter/internal/opengl.GLFWWindowHint()
	/home/hugh/go/pkg/mod/github.com/go-flutter-desktop/[email protected]/internal/opengl/opengl.go:73 +0x25
github.com/go-flutter-desktop/go-flutter.(*Application).Run(0xc0000e0000)
	/home/hugh/go/pkg/mod/github.com/go-flutter-desktop/[email protected]/application.go:120 +0x23c
github.com/go-flutter-desktop/go-flutter.Run({0xc0000a6048, 0xc0000a6050, 0x5b0dcc})
	/home/hugh/go/pkg/mod/github.com/go-flutter-desktop/[email protected]/application.go:26 +0x25
main.main()
	/home/hugh/Builds/surf_diary/go/cmd/main.go:24 +0x199
hover: App 'surf_diary' exited with error: exit status 2

Process Hover exited abnormally with code 2

Using hover run from the terminal works fine. I have the glfw-wayland package installed.

Hover problem when running flutter app

Following the configuration example and variables, I'm trying to configure hover to work with my flutter project. I run into the problem that hover is not recognizing the path from which I'm running the command "hover-run-or-hot-reload".

The error is the following:

hover: Error: No pubspec.yaml file found: open pubspec.yaml: no such file or directory
hover: This command should be run from the root of your Flutter project.

Process Hover exited abnormally with code 1

The error is triggered running "hover-run-or-hot-reload" from my main.dart file.

My init.el file regarding lsp-dart and hover.el:

(use-package lsp-dart 
  :ensure t
  :hook (dart-mode . lsp-deferred)
  :custom (lsp-dart-sdk-dir "<HOME>/snap/flutter/common/flutter/bin/cache/dart-sdk")
  (lsp-dart-flutter-sdk-dir "<HOME>/snap/flutter/common/flutter")
  (dart-format-on-save t))

(use-package hover
  :ensure t
  :after dart-mode
  :custom (hover-command-path "<HOME>/go/bin/hover")
  (hover-hot-reload-on-save t)
  (hover-flutter-sdk-path "<HOME>/snap/flutter/common/flutter")
  :bind (:map dart-mode-map ("C-M-z" . hover-run-or-hot-reload)))

I would love to be able to use hover, as it is the best alternative to emulators. I appreciate a lot the work you are doing, keep it up!

Hover not work if current hover-mode was start on another frame

Both hover-run-or-hot-reload and hover-hot-reload-on-save option all not works if current hover-mode buffer was switch back to hidden this buffer.

Debugger entered--Lisp error: (wrong-type-argument window-live-p nil)
  hover--run-command-on-hover-buffer("r")
  hover--hot-reload()
  run-hooks(after-save-hook)
  basic-save-buffer(nil)
  #<subr save-buffer>(1)
  ad-Advice-save-buffer(#<subr save-buffer> 1)
  apply(ad-Advice-save-buffer #<subr save-buffer> 1)
  save-buffer(1)
  funcall-interactively(save-buffer 1)
  #<subr command-execute>(save-buffer nil nil nil)
  ad-Advice-command-execute(#<subr command-execute> save-buffer)
  apply(ad-Advice-command-execute #<subr command-execute> save-buffer)
  command-execute(save-buffer)

Configuration of hover window

Hey, I hope everything is going fine!
I was trying out hover again this afternoon and was wondering about the possibility of configuring the hover output window. I was guessing that the hover window gets initialized to the space that it has available, but I find that my hover window isn't really scaled correctly.
I checked the readme again as I remembered that there was an example gif on it and I saw that the example shows a hover window that has been configured (or scaled automatically) to look like a phone screen!
I would love the information to be contained in the readme or documentation!
Have a great day!
Enrique.

Hover insists on making a desktop_main.dart

I see in the gif in the readme you have hover running main.dart. How were you able to accomplish this? everytime I run hover it insists on making a desktop_main and when I select no it says rerun with --target, which isn't possible via hover.el (at least I think so).

emulator replacement

Hi,
Android does not provide emulators for ARM64 Is this project a replacement for Android's emulators?

Best wishes,

Michal

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.