• cradlemann@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    You setup looks not so optimal. Here is mine

    (use-package go-mode
      :ensure t
      :mode "\\.go\\'"
      :preface
      (defun vd/go-lsp-start()
                   (add-hook 'before-save-hook #'lsp-format-buffer t t)
                   (add-hook 'before-save-hook #'lsp-organize-imports t t)
                   (lsp-deferred)
                   )
      :hook
      (go-ts-mode . vd/go-lsp-start)
      :bind
      (:map go-ts-mode-map
            ("RET" . newline-and-indent)
            ("M-RET" . newline)
            )
      :config
      (add-to-list 'exec-path "~/.local/bin")
      (setq lsp-go-analyses '(
                              (nilness . t)
                              (shadow . t)
                              (unusedwrite . t)
                              (fieldalignment . t)
                                           )
            lsp-go-codelenses '(
                              (test . t)
                              (tidy . t)
                              (upgrade_dependency . t)
                              (vendor . t)
                              (run_govulncheck . t)
                                           )
            )
    )
    
    (use-package go-tag
      :ensure t
    )
    
    (use-package godoctor
      :ensure t
    )
    
    • 404cn@alien.topB
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      It’s wired after I config go-ts-indent-offset to 4, the indent after } and ) still indent 8 spaces(I think it’s from electric-indent-mode), and content after treesit-check-indent also use 8 spaces, but bind RET to newline-and-indent is a workaround for me now, thanks.

      • 404cn@alien.topB
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Sorry, but after type ( it still indent current line to 8 space(not RET), I’m going to report a bug to emacs devel.