Coder Social home page Coder Social logo

Comments (8)

dominikh avatar dominikh commented on August 16, 2024 2

That's great! With that I consider this issue closed.

I don't. Using that mode loses you most of the features of the current go-mode, and doesn't use tree-sitter to its full potential to replace most of the custom navigation functions in go-mode, like go-goto-arguments.

Big fan of the fact they took the name go-ts-mode, too, while not owning go-mode.

from go-mode.el.

To1ne avatar To1ne commented on August 16, 2024 1

Now tree-sitter is built-in in the new Emacs, this issue has become more relevant.

I think as a start we can implement a go-ts-mode (similar to other -ts-modes). I'd love to have a look at it, when I find some time.

There are some guidelines on how to do this at https://git.savannah.gnu.org/cgit/emacs.git/tree/admin/notes/tree-sitter/starter-guide

from go-mode.el.

zwpaper avatar zwpaper commented on August 16, 2024 1

FYI

Emacs has worked on a go-ts-mode, https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=fee2efe1b035d601ac53a32801227402e9be8bca

from go-mode.el.

To1ne avatar To1ne commented on August 16, 2024 1

Emacs has worked on a go-ts-mode, https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=fee2efe1b035d601ac53a32801227402e9be8bca

That's great! With that I consider this issue closed.

One thing would be nice though, if it would be possible to use gofmt-before-save with go-ts-mode. The change would be something along the lines of:

 (defun gofmt-before-save ()
   "Add this to .emacs to run gofmt on the current buffer when saving:
 \(add-hook 'before-save-hook 'gofmt-before-save).

 Note that this will cause ‘go-mode’ to get loaded the first time
 you save any file, kind of defeating the point of autoloading."

   (interactive)
-   (when (eq major-mode 'go-mode) (gofmt)))
+   (when (member major-mode '(go-mode go-ts-mode)) (gofmt)))

Until that, I have this in my config:

(defun my-go-mode-setup ()
  "Setup Go mode to my liking."
  (add-hook 'before-save-hook 'gofmt nil t))

(use-package go-mode
  :ensure t
  :mode (("\\.go$" . go-ts-mode))
  :hook ((go-mode go-ts-mode) . my-go-mode-setup)
  :custom (gofmt-command "goimports"))

Or you could use this if you like: https://gist.github.com/GnaneshKunal/3d3f982ce1903990eedd586952893422

from go-mode.el.

edkolev avatar edkolev commented on August 16, 2024

Is it viable to contribute go-ts-mode to emacs itself? With eglot already part of emacs, emacs will be able to provide modern Go environment out of the box, provided gopls is available.

from go-mode.el.

dominikh avatar dominikh commented on August 16, 2024

If you want to put up with GNU and the FSF to get your code into Emacs, feel free to. I, however, won't take part in that.

(I think there are also less political arguments against having go-ts-mode in Emacs, such as mismatching release cycles between Go and Emacs.)

from go-mode.el.

dominikh avatar dominikh commented on August 16, 2024

Based on the document To1ne linked to, it seems like we should implement a new major mode go-ts-mode. Code that can be shared between the current go-mode and the new go-ts-mode will go in a base mode go-base-mode.

I will probably work on this myself in the near future.

from go-mode.el.

dominikh avatar dominikh commented on August 16, 2024

Closing in favour of #428.

from go-mode.el.

Related Issues (20)

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.