Doom-emacs: Pelengkapan otomatis Golang + linting

Dibuat pada 25 Jan 2020  ·  25Komentar  ·  Sumber: hlissner/doom-emacs

Apa yang ingin Anda capai?
Saat mengetik nama paket seperti fmt atau os Saya ingin melihat daftar fungsi yang tersedia seperti fmt.Println() . Selain itu, saat ini, saya hanya mendapatkan indikasi visual untuk kesalahan saat file disimpan. Saya ingin sekali melihat kesalahan / kesalahan ketik secara real-time.

Apa yang sudah kamu coba?
Saya telah mencoba menambahkan paket seperti (packages! go-autocomplete) ke file packages.el, saya mencari dukungan eldoc, dan akhirnya saya memposting masalah sebelumnya (yang segera diselesaikan, omong-omong! Anda keren.) Yang saya pikir akan menyelesaikan masalah dengan membuat bahasa go dikenali.

Tentu saja, saya tidak dapat mengesampingkan bahwa mungkin ada sesuatu yang saya lewatkan karena saya baru mengenal emacs dan usaha pertama saya ke dalamnya adalah menggunakan Doom (karena tbh itu terlihat luar biasa).

Informasi tambahan

Sistem Informasi

emacs   version    26.3
        features   XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD LCMS2
        build      Sep 16, 2019
        buildopts  (--build=x86_64-linux-gnu --prefix=/usr '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib --program-suffix=26 --with-modules --with-file-notification=inotify --with-mailutils --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets --with-lcms2 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs26-TP6iDo/emacs26-26.3~1.git96dd019=. -fstack-protector-strong -Wformat -Werror=format-security -no-pie' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -no-pie')
        windowsys  x
        daemonp    server-running
doom    version    2.0.9
        build      HEAD -> develop, origin/develop, origin/HEAD 3ebdc513f 2020-01-24 05:16:09 -0500
        dir        ~/.doom.d/
system  type       gnu/linux
        config     x86_64-pc-linux-gnu
        shell      /bin/bash
        uname      Linux 5.3.0-26-generic #28~18.04.1-Ubuntu SMP Wed Dec 18 16:40:14 UTC 2019 x86_64
        path       (~/.emacs.d/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /usr/local/go/bin /usr/lib/x86_64-linux-gnu/emacs/26.3/x86_64-linux-gnu/)
config  envfile    envvar-file
        elc-files  0
        modules    (:completion (company +auto) ivy :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash neotree ophints (popup +all +defaults) vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold multiple-cursors rotate-text snippets :emacs electric ibuffer vc :term term :checkers syntax :tools (eval +overlay) (lookup +docsets) magit :lang data emacs-lisp (go +lsp) javascript markdown (org +dragndrop +hugo +present) python sh :config (default +bindings +smartparens))
        packages   ((company-go :pin "939b4a677f2f843ea13d9dd90206d57111f0ceb9"))
        elpa       (popup go-autocomplete auto-complete)

:completion company :lang go :tools lsp question

Semua 25 komentar

Saya tidak yakin apakah ini mungkin dicapai dengan go-autocomplete Saya menggunakan (go +lsp) dan memiliki semua fitur yang ingin Anda miliki.

Saya memiliki (go +lsp) dalam file .doom.d / init.el saya, tetapi tampaknya tidak melakukan pelengkapan otomatis bahkan untuk pustaka standar, seperti pada tangkapan layar. Emacs saya pada dasarnya 100% segar, jadi saya rasa tidak ada konflik lain.

Jika itu membuat perbedaan, saya di Mint

@Proziam Bisakah Anda menempelkan lsp-log pesan?

@ iris-garcia Saya akan dengan senang hati, dapatkah Anda memberi saya petunjuk tentang di mana menemukan lsp-log? Maaf karena menjadi noob, saya mencoba mencari beberapa informasi dari google tetapi menemukan menyebutkan keberadaan log lsp tetapi tidak bagaimana cara mengaksesnya.

@Proziam Aktifkan mode debug dengan SPC h d d (atau M-x doom/toggle-debug-mode ) dan lsp harus membuat buffer *lsp-log* Anda dapat beralih (dengan SPC b b ).

@hlner terima kasih banyak! Inilah yang saya dapatkan kembali:

Debugger entered--Lisp error: (error "Empty string for buffer name is not allowed")
  get-buffer-create("")
  window-normalize-buffer-to-switch-to("")
  #f(compiled-function (buffer-or-name &optional norecord force-same-window) "Display buffer BUFFER-OR-NAME in the selected window.\n\nWARNING: This is NOT the way to work on another buffer temporarily\nwithin a Lisp program!  Use `set-buffer' instead.  That avoids\nmessing with the window-buffer correspondences.\n\nIf the selected window cannot display the specified buffer\nbecause it is a minibuffer window or strongly dedicated to\nanother buffer, call `pop-to-buffer' to select the buffer in\nanother window.  In interactive use, if the selected window is\nstrongly dedicated to its buffer, the value of the option\n`switch-to-buffer-in-dedicated-window' specifies how to proceed.\n\nIf called interactively, read the buffer name using `read-buffer'.\nThe variable `confirm-nonexistent-file-or-buffer' determines\nwhether to request confirmation before creating a new buffer.\nSee `read-buffer' for features related to input and completion\nof buffer names.\n\nBUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil.\nIf BUFFER-OR-NAME is a string that does not identify an existing\nbuffer, create a buffer with that name.  If BUFFER-OR-NAME is\nnil, switch to the buffer returned by `other-buffer'.\n\nIf optional argument NORECORD is non-nil, do not put the buffer\nat the front of the buffer list, and do not make the window\ndisplaying it the most recently selected one.\n\nIf optional argument FORCE-SAME-WINDOW is non-nil, the buffer\nmust be displayed in the selected window when called\nnon-interactively; if that is impossible, signal an error rather\nthan calling `pop-to-buffer'.\n\nThe option `switch-to-buffer-preserve-window-point' can be used\nto make the buffer appear at its last position in the selected\nwindow.\n\nReturn the buffer switched to." (interactive #f(compiled-function () #<bytecode 0x1a4bdad>)) #<bytecode 0x2304cf>)("" nil force-same-window)
  apply(#f(compiled-function (buffer-or-name &optional norecord force-same-window) "Display buffer BUFFER-OR-NAME in the selected window.\n\nWARNING: This is NOT the way to work on another buffer temporarily\nwithin a Lisp program!  Use `set-buffer' instead.  That avoids\nmessing with the window-buffer correspondences.\n\nIf the selected window cannot display the specified buffer\nbecause it is a minibuffer window or strongly dedicated to\nanother buffer, call `pop-to-buffer' to select the buffer in\nanother window.  In interactive use, if the selected window is\nstrongly dedicated to its buffer, the value of the option\n`switch-to-buffer-in-dedicated-window' specifies how to proceed.\n\nIf called interactively, read the buffer name using `read-buffer'.\nThe variable `confirm-nonexistent-file-or-buffer' determines\nwhether to request confirmation before creating a new buffer.\nSee `read-buffer' for features related to input and completion\nof buffer names.\n\nBUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil.\nIf BUFFER-OR-NAME is a string that does not identify an existing\nbuffer, create a buffer with that name.  If BUFFER-OR-NAME is\nnil, switch to the buffer returned by `other-buffer'.\n\nIf optional argument NORECORD is non-nil, do not put the buffer\nat the front of the buffer list, and do not make the window\ndisplaying it the most recently selected one.\n\nIf optional argument FORCE-SAME-WINDOW is non-nil, the buffer\nmust be displayed in the selected window when called\nnon-interactively; if that is impossible, signal an error rather\nthan calling `pop-to-buffer'.\n\nThe option `switch-to-buffer-preserve-window-point' can be used\nto make the buffer appear at its last position in the selected\nwindow.\n\nReturn the buffer switched to." (interactive #f(compiled-function () #<bytecode 0x1a4bf09>)) #<bytecode 0x2304cf>) "" (nil force-same-window))
  (and t (apply orig-fn buffer-or-name args))
  (let* ((buffer (and t (apply orig-fn buffer-or-name args)))) (if buffer (progn (save-current-buffer (set-buffer (if (windowp buffer) (window-buffer buffer) buffer)) (run-hooks (quote doom-switch-buffer-hook))) buffer) nil))
  (let ((doom-inhibit-switch-buffer-hooks t)) (let* ((buffer (and t (apply orig-fn buffer-or-name args)))) (if buffer (progn (save-current-buffer (set-buffer (if (windowp buffer) (window-buffer buffer) buffer)) (run-hooks (quote doom-switch-buffer-hook))) buffer) nil)))
  (if (or doom-inhibit-switch-buffer-hooks (eq (current-buffer) (get-buffer buffer-or-name)) (and (eq orig-fn (function switch-to-buffer)) (car args))) (apply orig-fn buffer-or-name args) (let ((doom-inhibit-switch-buffer-hooks t)) (let* ((buffer (and t (apply orig-fn buffer-or-name args)))) (if buffer (progn (save-current-buffer (set-buffer (if ... ... buffer)) (run-hooks (quote doom-switch-buffer-hook))) buffer) nil))))
  (let ((gc-cons-threshold most-positive-fixnum)) (if (or doom-inhibit-switch-buffer-hooks (eq (current-buffer) (get-buffer buffer-or-name)) (and (eq orig-fn (function switch-to-buffer)) (car args))) (apply orig-fn buffer-or-name args) (let ((doom-inhibit-switch-buffer-hooks t)) (let* ((buffer (and t (apply orig-fn buffer-or-name args)))) (if buffer (progn (save-current-buffer (set-buffer ...) (run-hooks ...)) buffer) nil)))))
  doom-run-switch-buffer-hooks-a(#f(compiled-function (buffer-or-name &optional norecord force-same-window) "Display buffer BUFFER-OR-NAME in the selected window.\n\nWARNING: This is NOT the way to work on another buffer temporarily\nwithin a Lisp program!  Use `set-buffer' instead.  That avoids\nmessing with the window-buffer correspondences.\n\nIf the selected window cannot display the specified buffer\nbecause it is a minibuffer window or strongly dedicated to\nanother buffer, call `pop-to-buffer' to select the buffer in\nanother window.  In interactive use, if the selected window is\nstrongly dedicated to its buffer, the value of the option\n`switch-to-buffer-in-dedicated-window' specifies how to proceed.\n\nIf called interactively, read the buffer name using `read-buffer'.\nThe variable `confirm-nonexistent-file-or-buffer' determines\nwhether to request confirmation before creating a new buffer.\nSee `read-buffer' for features related to input and completion\nof buffer names.\n\nBUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil.\nIf BUFFER-OR-NAME is a string that does not identify an existing\nbuffer, create a buffer with that name.  If BUFFER-OR-NAME is\nnil, switch to the buffer returned by `other-buffer'.\n\nIf optional argument NORECORD is non-nil, do not put the buffer\nat the front of the buffer list, and do not make the window\ndisplaying it the most recently selected one.\n\nIf optional argument FORCE-SAME-WINDOW is non-nil, the buffer\nmust be displayed in the selected window when called\nnon-interactively; if that is impossible, signal an error rather\nthan calling `pop-to-buffer'.\n\nThe option `switch-to-buffer-preserve-window-point' can be used\nto make the buffer appear at its last position in the selected\nwindow.\n\nReturn the buffer switched to." (interactive #f(compiled-function () #<bytecode 0xfcdd09>)) #<bytecode 0x2304cf>) "" nil force-same-window)
  apply(doom-run-switch-buffer-hooks-a #f(compiled-function (buffer-or-name &optional norecord force-same-window) "Display buffer BUFFER-OR-NAME in the selected window.\n\nWARNING: This is NOT the way to work on another buffer temporarily\nwithin a Lisp program!  Use `set-buffer' instead.  That avoids\nmessing with the window-buffer correspondences.\n\nIf the selected window cannot display the specified buffer\nbecause it is a minibuffer window or strongly dedicated to\nanother buffer, call `pop-to-buffer' to select the buffer in\nanother window.  In interactive use, if the selected window is\nstrongly dedicated to its buffer, the value of the option\n`switch-to-buffer-in-dedicated-window' specifies how to proceed.\n\nIf called interactively, read the buffer name using `read-buffer'.\nThe variable `confirm-nonexistent-file-or-buffer' determines\nwhether to request confirmation before creating a new buffer.\nSee `read-buffer' for features related to input and completion\nof buffer names.\n\nBUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil.\nIf BUFFER-OR-NAME is a string that does not identify an existing\nbuffer, create a buffer with that name.  If BUFFER-OR-NAME is\nnil, switch to the buffer returned by `other-buffer'.\n\nIf optional argument NORECORD is non-nil, do not put the buffer\nat the front of the buffer list, and do not make the window\ndisplaying it the most recently selected one.\n\nIf optional argument FORCE-SAME-WINDOW is non-nil, the buffer\nmust be displayed in the selected window when called\nnon-interactively; if that is impossible, signal an error rather\nthan calling `pop-to-buffer'.\n\nThe option `switch-to-buffer-preserve-window-point' can be used\nto make the buffer appear at its last position in the selected\nwindow.\n\nReturn the buffer switched to." (interactive #f(compiled-function () #<bytecode 0xfcde65>)) #<bytecode 0x2304cf>) ("" nil force-same-window))
  #f(advice-wrapper :around #f(compiled-function (buffer-or-name &optional norecord force-same-window) "Display buffer BUFFER-OR-NAME in the selected window.\n\nWARNING: This is NOT the way to work on another buffer temporarily\nwithin a Lisp program!  Use `set-buffer' instead.  That avoids\nmessing with the window-buffer correspondences.\n\nIf the selected window cannot display the specified buffer\nbecause it is a minibuffer window or strongly dedicated to\nanother buffer, call `pop-to-buffer' to select the buffer in\nanother window.  In interactive use, if the selected window is\nstrongly dedicated to its buffer, the value of the option\n`switch-to-buffer-in-dedicated-window' specifies how to proceed.\n\nIf called interactively, read the buffer name using `read-buffer'.\nThe variable `confirm-nonexistent-file-or-buffer' determines\nwhether to request confirmation before creating a new buffer.\nSee `read-buffer' for features related to input and completion\nof buffer names.\n\nBUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil.\nIf BUFFER-OR-NAME is a string that does not identify an existing\nbuffer, create a buffer with that name.  If BUFFER-OR-NAME is\nnil, switch to the buffer returned by `other-buffer'.\n\nIf optional argument NORECORD is non-nil, do not put the buffer\nat the front of the buffer list, and do not make the window\ndisplaying it the most recently selected one.\n\nIf optional argument FORCE-SAME-WINDOW is non-nil, the buffer\nmust be displayed in the selected window when called\nnon-interactively; if that is impossible, signal an error rather\nthan calling `pop-to-buffer'.\n\nThe option `switch-to-buffer-preserve-window-point' can be used\nto make the buffer appear at its last position in the selected\nwindow.\n\nReturn the buffer switched to." (interactive #f(compiled-function () #<bytecode 0x1c0af79>)) #<bytecode 0x2304cf>) doom-run-switch-buffer-hooks-a)("" nil force-same-window)
  ad-Advice-switch-to-buffer(#f(advice-wrapper :around #f(compiled-function (buffer-or-name &optional norecord force-same-window) "Display buffer BUFFER-OR-NAME in the selected window.\n\nWARNING: This is NOT the way to work on another buffer temporarily\nwithin a Lisp program!  Use `set-buffer' instead.  That avoids\nmessing with the window-buffer correspondences.\n\nIf the selected window cannot display the specified buffer\nbecause it is a minibuffer window or strongly dedicated to\nanother buffer, call `pop-to-buffer' to select the buffer in\nanother window.  In interactive use, if the selected window is\nstrongly dedicated to its buffer, the value of the option\n`switch-to-buffer-in-dedicated-window' specifies how to proceed.\n\nIf called interactively, read the buffer name using `read-buffer'.\nThe variable `confirm-nonexistent-file-or-buffer' determines\nwhether to request confirmation before creating a new buffer.\nSee `read-buffer' for features related to input and completion\nof buffer names.\n\nBUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil.\nIf BUFFER-OR-NAME is a string that does not identify an existing\nbuffer, create a buffer with that name.  If BUFFER-OR-NAME is\nnil, switch to the buffer returned by `other-buffer'.\n\nIf optional argument NORECORD is non-nil, do not put the buffer\nat the front of the buffer list, and do not make the window\ndisplaying it the most recently selected one.\n\nIf optional argument FORCE-SAME-WINDOW is non-nil, the buffer\nmust be displayed in the selected window when called\nnon-interactively; if that is impossible, signal an error rather\nthan calling `pop-to-buffer'.\n\nThe option `switch-to-buffer-preserve-window-point' can be used\nto make the buffer appear at its last position in the selected\nwindow.\n\nReturn the buffer switched to." (interactive #f(compiled-function () #<bytecode 0x1c0b129>)) #<bytecode 0x2304cf>) doom-run-switch-buffer-hooks-a) "" nil force-same-window)
  apply(ad-Advice-switch-to-buffer #f(advice-wrapper :around #f(compiled-function (buffer-or-name &optional norecord force-same-window) "Display buffer BUFFER-OR-NAME in the selected window.\n\nWARNING: This is NOT the way to work on another buffer temporarily\nwithin a Lisp program!  Use `set-buffer' instead.  That avoids\nmessing with the window-buffer correspondences.\n\nIf the selected window cannot display the specified buffer\nbecause it is a minibuffer window or strongly dedicated to\nanother buffer, call `pop-to-buffer' to select the buffer in\nanother window.  In interactive use, if the selected window is\nstrongly dedicated to its buffer, the value of the option\n`switch-to-buffer-in-dedicated-window' specifies how to proceed.\n\nIf called interactively, read the buffer name using `read-buffer'.\nThe variable `confirm-nonexistent-file-or-buffer' determines\nwhether to request confirmation before creating a new buffer.\nSee `read-buffer' for features related to input and completion\nof buffer names.\n\nBUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil.\nIf BUFFER-OR-NAME is a string that does not identify an existing\nbuffer, create a buffer with that name.  If BUFFER-OR-NAME is\nnil, switch to the buffer returned by `other-buffer'.\n\nIf optional argument NORECORD is non-nil, do not put the buffer\nat the front of the buffer list, and do not make the window\ndisplaying it the most recently selected one.\n\nIf optional argument FORCE-SAME-WINDOW is non-nil, the buffer\nmust be displayed in the selected window when called\nnon-interactively; if that is impossible, signal an error rather\nthan calling `pop-to-buffer'.\n\nThe option `switch-to-buffer-preserve-window-point' can be used\nto make the buffer appear at its last position in the selected\nwindow.\n\nReturn the buffer switched to." (interactive #f(compiled-function () #<bytecode 0x1c85ad9>)) #<bytecode 0x2304cf>) doom-run-switch-buffer-hooks-a) ("" nil force-same-window))
  switch-to-buffer("" nil force-same-window)
  ivy--switch-buffer-action("")
  ivy-call()
  ivy-read("Switch to workspace buffer: " internal-complete-buffer :action ivy--switch-buffer-action :predicate +ivy--is-workspace-other-buffer-p :update-fn nil :unwind nil :preselect "*scratch*" :matcher ivy--switch-buffer-matcher :keymap (keymap (33554443 . scroll-down-command) (33554442 . scroll-up-command) (10 . next-line) (26 closure (t) nil (interactive) (condition-case nil (progn (call-interactively (function undo))) (error nil))) (23 . doom/delete-backward-word) (22 . yank) (21 . evil-delete-back-to-indentation) (18 . evil-paste-from-register) (1 . move-beginning-of-line) (escape . abort-recursive-edit) (19 . counsel-minibuffer-history) (11 . previous-line)) :caller ivy-switch-buffer)
  (let ((current (not other)) prompt action filter update unwind) (cond ((and workspace current) (setq prompt "Switch to workspace buffer: " action (function ivy--switch-buffer-action) filter (function +ivy--is-workspace-other-buffer-p))) (workspace (setq prompt "Switch to workspace buffer in other window: " action (function ivy--switch-buffer-other-window-action) filter (function +ivy--is-workspace-buffer-p))) (current (setq prompt "Switch to buffer: " action (function ivy--switch-buffer-action))) ((setq prompt "Switch to buffer in other window: " action (function ivy--switch-buffer-other-window-action)))) (if +ivy-buffer-preview (progn (cond ((not (and ivy-use-virtual-buffers (eq +ivy-buffer-preview ...))) (setq update (function +ivy--switch-buffer-preview) unwind (function +ivy--switch-buffer-unwind))) ((setq update (function +ivy--switch-buffer-preview-all) unwind (function +ivy--switch-buffer-unwind)))))) (ivy-read prompt (quote internal-complete-buffer) :action action :predicate filter :update-fn update :unwind unwind :preselect (buffer-name (other-buffer (current-buffer))) :matcher (function ivy--switch-buffer-matcher) :keymap ivy-switch-buffer-map :caller (function ivy-switch-buffer)))
  +ivy--switch-buffer(t nil)
  +ivy/switch-workspace-buffer(nil)
  funcall-interactively(+ivy/switch-workspace-buffer nil)
  call-interactively(+ivy/switch-workspace-buffer nil nil)
  command-execute(+ivy/switch-workspace-buffer)

Seperti yang muncul di layar saya (mungkin lebih mudah dibaca): Screenshot

BTW, saya mencoba beralih menggunakan SPC b b tetapi hanya mendapatkan buffer ruang kerja, tidak ada yang terkait dengan lsp. Saya tidak begitu yakin apa yang saya tekan untuk mendapatkan ini, hanya mencoba beberapa hal untuk melihat apa yang dapat saya lakukan.

Hai @Proziam , saya berhasil menyelesaikan LSP. Sudahkah Anda memeriksa bahwa emacs Anda benar-benar dapat menemukan perintah gopls ? Anda dapat mencobanya dengan menjalankannya di shell di emacs misalnya.

Tentang info cara menginstal gopls periksa: https://github.com/golang/tools/blob/master/gopls/doc/user.md#installation

@Proziam Maaf atas tanggapan yang terlambat.

BTW, saya mencoba beralih menggunakan SPC bb tetapi hanya mendapatkan buffer ruang kerja, tidak ada yang berhubungan dengan lsp. Saya tidak begitu yakin apa yang saya tekan untuk mendapatkan ini, hanya mencoba beberapa hal untuk melihat apa yang dapat saya lakukan.

SPC b b hanya mencantumkan buffer ruang kerja. SPC b B akan mencantumkan semua buffer, di semua ruang kerja (dan lainnya). Anda pasti ingin yang terakhir menemukan *lsp-log* .

Bagaimanapun, kesalahan tertentu yang Anda sebutkan tidak terkait, tetapi telah diperbaiki sekitar bulan lalu. Coba tingkatkan Doom. Mungkin masalah Go Anda akan teratasi bersamaan dengan itu.

Saat mengetik nama paket seperti fmt atau os saya ingin melihat daftar fungsi yang tersedia seperti fmt.Println ().

Yang mengkhawatirkan tentang konfigurasi Anda adalah bahwa Anda tampaknya telah menginstal company-go , auto-complete dan go-autocomplete . auto-complete bentrok dengan perusahaan, dan modul :lang go sudah menginstal company-go untuk Anda. Ada kemungkinan konflik. Saya sarankan untuk menghapusnya dari package.el Anda dan menjalankan doom purge .

Dengan :lang (go +lsp) kami menggunakan LSP (selama gopls terinstal ). LSP sangat bagus dalam pelengkapan kode, dan mungkin itulah yang Anda inginkan.

Dengan :lang go (tanpa +lsp ), itu kembali ke company-go , yang menggunakan stamblerre / gocode yang diinstal pada sistem Anda . Ini (dari apa yang saya diberitahu) lebih rendah dari LSP.

Selain itu, saat ini, saya hanya mendapatkan indikasi visual untuk kesalahan saat file disimpan. Saya ingin sekali melihat kesalahan / kesalahan ketik secara real-time.

Kami telah membatasi flycheck untuk memeriksa hanya jika Anda menyimpan demi kinerja. Dengan mengubah flycheck-check-syntax-automatically Anda dapat memeriksanya secara real time:

(after! flycheck
  (setq flycheck-check-syntax-automatically '(save idle-change new-line mode-enabled)))

Lihat SPC h v flycheck-check-syntax-automatically (atau C-h v flycheck-check-syntax-automatically jika Anda tidak menggunakan kejahatan) untuk kemungkinan nilai lebih untuk variabel ini.


Semoga membantu!

apakah ada cara untuk mengaktifkan menampilkan jenis saat mengarahkan kursor?

Halo. Saya mencoba beralih dari spacemac ke malapetaka dan untuk saat ini saya memiliki kedua distribusi.
Saya baru saja menginstal doom emacs, uncomment (go + lsp) dan ketika saya membuka beberapa file proyek * .go, status gopl secara permanen connecting dan tidak ada linting, tidak ada pelengkapan otomatis.
Di sisi lain, saya memulai spacemac dengan sekumpulan alat yang sama dan berfungsi dengan baik.


Buffer pesan

LSP :: Guessed project root is ~/Documents/projects/another-go-test
LSP :: Connected to [gopls:25870 status:starting].
LSP :: json: cannot unmarshal object into Go struct field .capabilities.textDocument.publishDiagnostics.tagSupport of type bool



Buffer log LSP

Command "gopls" is present on the path.
Command "bingo" is present on the path.
Command "go-langserver" is present on the path.
Found the following clients for /home/user/Documents/projects/another-go-test/main.go: (server-id gopls, priority 0), (server-id go-bingo, priority -1), (server-id go-ls, priority -2)
The following clients were selected based on priority: (server-id gopls, priority 0)

Perilaku
Screenshot_20200304_004640

Dan status gopl selalu starting

Maaf untuk bahasa Inggris saya.
Salam.

@hlissner terima kasih atas bantuannya! Sepertinya ada konflik seperti yang Anda tunjukkan. Saya pasti akan mencoba perubahan flycheck juga.

menganggap ini terpecahkan untuk saya - tetapi tampaknya beberapa orang lain memiliki pertanyaan jadi saya akan membiarkan orang lain mengambil keputusan untuk menutup atau tidak.

Saya memperbaiki masalah saya. Baru saja menghapus go-tools yang saya instal dari repositori os saya, dan masalahnya hilang.

Saya memiliki masalah yang sama, dan saya tidak melihat log apa pun saat memasukkan emacs ke mode debug.

Sama di sini, install baru, go tools diinstal, direktori bin ada dalam daftar jalur exec dan saya dapat menjalankan gopls dari shell emacs (mendapatkan gopls: terputus). Namun saya tidak melihat buffer lsp-log dan tidak ada pesan kesalahan lainnya. Pelengkapan otomatis tidak berfungsi, ketika saya mencobanya secara manual dengan ctrl + spasi, ia bahkan tidak menyarankan nama lokal dari file yang sama. Ada ide tentang cara men-debug?

Ok, benar-benar buruk ... lsp tidak diaktifkan. :( facepalm. Sekarang semuanya bekerja seperti pesona.

Hai! Saya juga mengalami masalah saat mengaktifkan pelengkapan otomatis / lsp.

Saya mendapatkan ini di *lsp-log* meskipun gopls adalah PATH yang dihasilkan dalam ~/.emacs.d/.local/env :

Command "gopls" is not present on the path.
Command "bingo" is not present on the path.
Command "go-langserver" is not present on the path.

Flycheck berfungsi. Saya hanya mengaktifkan (go +lsp) dan lsp di .doom.d/init.el . Apakah saya perlu menambahkan sesuatu ke .doom.d/config.el agar LSP dapat menemukan barang saya di PATH?

Hai, saya juga mengalami masalah,
Saya tidak bisa menemukan cara untuk membuat pelengkapan otomatis berfungsi
lsp-log saya

Command "gopls" is present on the path.
Command "bingo" is not present on the path.
Command "go-langserver" is not present on the path.
Found the following clients for /home/arconec/bo/main.go: (server-id gopls, priority 0)
The following clients were selected based on priority: (server-id gopls, priority 0)
2020/05/23 17:10:59 Build info
----------
golang.org/x/tools/cmd/gopls master-cmd.gopls
    golang.org/x/tools@(devel)
    golang.org/x/[email protected] h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/[email protected] h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=

Go info
-------
go version go1.14.2 linux/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/arconec/.cache/go-build"
GOENV="/home/arconec/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/arconec/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/arconec/bo/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build445920769=/tmp/go-build -gno-record-gcc-switches"

2020/05/23 17:10:59 go/packages.Load
    packages = 9
2020/05/23 17:10:59 go/packages.Load
    package = contree/models
    files = [/home/arconec/bo/models/db.go /home/arconec/bo/models/user.go]
2020/05/23 17:10:59 go/packages.Load
    package = contree/api/auth
    files = [/home/arconec/bo/api/auth/auth.ctrl.go /home/arconec/bo/api/auth/auth.go]
2020/05/23 17:10:59 go/packages.Load
    package = contree/api
    files = [/home/arconec/bo/api/api.go]
2020/05/23 17:10:59 go/packages.Load
    package = contree/game
    files = [/home/arconec/bo/game/call.go /home/arconec/bo/game/card.go /home/arconec/bo/game/contree.go /home/arconec/bo/game/deck.go]
2020/05/23 17:10:59 go/packages.Load
    package = contree/iohandler
    files = [/home/arconec/bo/iohandler/endpoints.go /home/arconec/bo/iohandler/game.go /home/arconec/bo/iohandler/io.go /home/arconec/bo/iohandler/lobby.go /home/arconec/bo/iohandler/player.go]
2020/05/23 17:10:59 go/packages.Load
    package = contree/game
    files = [/home/arconec/bo/game/call.go /home/arconec/bo/game/card.go /home/arconec/bo/game/contree.go /home/arconec/bo/game/deck.go /home/arconec/bo/game/card_test.go /home/arconec/bo/game/contree_test.go]
2020/05/23 17:10:59 go/packages.Load
    package = contree/api/ping
    files = [/home/arconec/bo/api/ping/ping.ctrl.go /home/arconec/bo/api/ping/ping.go]
2020/05/23 17:10:59 go/packages.Load
    package = contree/game.test
    files = [/home/arconec/.cache/go-build/8e/8e4d7ac0c8cd3125a4a70816dc0baea450332e7c59a9d2faa9b894391215d013-d]
2020/05/23 17:10:59 go/packages.Load
    package = contree
    files = [/home/arconec/bo/main.go]
2020/05/23 17:11:02 go/packages.Load
    packages = 1
2020/05/23 17:11:02 go/packages.Load
    package = contree
    files = [/home/arconec/bo/main.go]
2020/05/23 17:11:02 no package for file: no parsed files for package contree
2020/05/23 17:11:03 no package for file: no parsed files for package contree
2020/05/23 17:11:03 no package for file: no parsed files for package contree
2020/05/23 17:11:03 no package for file: no parsed files for package contree
2020/05/23 17:11:03 no package for file: no parsed files for package contree
2020/05/23 17:11:03 no package for file: no parsed files for package contree
2020/05/23 17:11:03 no completions found
    At = {27 6}
    Failure = no parsed files for package contree
2020/05/23 17:11:05 : line is beyond end of file 2
2020/05/23 17:11:05 : line is beyond end of file 2
2020/05/23 17:11:05 : line is beyond end of file 2
2020/05/23 17:11:05 : line is beyond end of file 2
2020/05/23 17:11:05 : line is beyond end of file 2

Ini ada di salah satu proyek saya.

Baru-baru ini saya juga menemukan sesuatu yang berkabel, kadang penyelesaiannya berhasil, kadang tidak. Dan saya tidak tahu mengapa ... Maaf, saya pemula ... Saya rasa itu karena masalah server bahasa. Di sini saya ingin membagikan beberapa info yang mungkin bisa membantu.

Saya Menginstal Secara Manual go-langserver dan bingo ( Jangan mencari tahu apakah kedua server ini penting, karena gopls adalah server prioritas pertama )

go get -u github.com/sourcegraph/go-langserver
go get -u github.com/saibing/bingo

Jika Anda juga menyukai Python sedikit lebih:

[sudo] pip3 install python-language-server

Setelah sinkronisasi ulang dan restart ( mungkin restart komputer Anda juga ... ) dan penyelesaiannya berfungsi dengan baik untuk saya sekarang 😭😇, dan *lsp-log* terlihat seperti ini:

image

Berikut beberapa konfigurasi yang mungkin terkait dengan masalah ini:

    :completion
    (company +auto)             ; the ultimate code completion backend

    :tools
    lsp

    :lang
    (go +lsp)
    (python +lsp
            +pyenv
            +cpython)            ; beautiful is better than ugly

Saya memperbaiki masalah saya. Baru saja menghapus go-tools yang saya instal dari repositori os saya, dan masalahnya hilang.

Ini memperbaiki masalah ("file.go" bukan bagian dari paket - LSP), dan pelengkapan otomatis kode sekarang berfungsi sebagaimana mestinya untuk saya di Arch Linux.

Hai semuanya. Saya mengalami masalah ini juga dan saya menelusuri kembali ke masalah dengan pembaruan ke lsp-mode.

https://github.com/emacs-lsp/lsp-mode/issues/1778

Menambahkan yang berikut ke config.el saya telah memecahkan masalah untuk sementara waktu. Perlu disebutkan bahwa saya menjalankan emacs 27 dan hanya dapat mereproduksi kesalahan ini dengan versi tersebut.

;; FIXME Fix for emacs 27
;; https://github.com/emacs-lsp/lsp-mode/issues/1778
(setq lsp-gopls-codelens nil)

Semoga bermanfaat, cheers

Hai semuanya. Saya mengalami masalah ini juga dan saya menelusuri kembali ke masalah dengan pembaruan ke lsp-mode.

emacs-lsp / lsp-mode # 1778

Menambahkan yang berikut ke config.el saya telah memecahkan masalah untuk sementara waktu. Perlu disebutkan bahwa saya menjalankan emacs 27 dan hanya dapat mereproduksi kesalahan ini dengan versi tersebut.

;; FIXME Fix for emacs 27
;; https://github.com/emacs-lsp/lsp-mode/issues/1778
(setq lsp-gopls-codelens nil)

Semoga bermanfaat, cheers

Telah berjuang dengan penyelesaian yang hilang juga. Ini melakukan trik untuk saya. Terima kasih banyak!

Bahkan saya memiliki masalah ini di Arch linux. Saya telah memasang go-tools . Saya mencopotnya dan mengikuti petunjuk di sini di modul doom emacs readme untuk dependensi. Sekarang ini bekerja dengan sempurna. Saya juga telah menginstal gopls dari halaman resmi di sini

Hai. Saya telah mencoba untuk pergi bekerja dan tidak ada petunjuk arah yang tampaknya membantu saya. Setiap kali saya membuka file go, itu menunjukkan pesan di bagian bawah mengatakan File local-variables error: (doom-hook-error lsp! (invalid-function lsp!)) . Saya menggunakan mac dan menggunakan semua versi terbaru emacs, go, dll.

Hai. Saya telah mencoba untuk pergi bekerja dan tidak ada petunjuk arah yang tampaknya membantu saya. Setiap kali saya membuka file go, itu menunjukkan pesan di bagian bawah mengatakan File local-variables error: (doom-hook-error lsp! (invalid-function lsp!)) . Saya menggunakan mac dan menggunakan semua versi terbaru emacs, go, dll.

@taylorallred Saya memiliki masalah yang sama dan saya baru saja berhasil memperbaikinya. Itu karena modul lsp tidak dimuat.

       :tools
       ;;ansible
       ;;debugger          ; FIXME stepping through code, to help you add bugs
       ;;direnv
       ;;docker
       ;;editorconfig      ; let someone else argue about tabs vs spaces
       ;;ein               ; tame Jupyter notebooks with emacs
       (eval +overlay)     ; run code, run (also, repls)
       ;;gist              ; interacting with github gists
       lookup              ; navigate your code and its documentation
       lsp
       ;;macos             ; MacOS-specific commands
       magit             ; a git porcelain for Emacs

Saya menemukan solusi saat menelusuri log debug, ada pesan tentangnya.

Saya telah menginstal semua hal dasar, tetapi saya tidak mendapatkan pelengkapan otomatis.

  • (go + lsp) dan lsp menambahkan init.el
  • gopls diinstal dan jalur ditambahkan
  • dokter malapetaka baik-baik saja
  • mencoba FIXME Fix untuk emacs 27

Sistem Informasi:


Jenis SISTEM gnu / linux
konfigurasi x86_64-pc-linux-gnu
shell / bin / bash
uname Linux 5.4.0-1025-gcp # 25-Ubuntu SMP Jum 11 Sep 15:02:15 UTC 2020 x86_64
jalur (/ usr / local / sbin / usr / local / bin / usr / sbin / usr / bin / sbin / bin / usr / games / usr / local / games / snap / bin ~ / .emacs.d / bin ~ / go / bin /snap/emacs/current/usr/libexec/emacs/27.1/x86_64-pc-linux-gnu)
Direktori EMACS ~ / .emacs.d /
versi 27.1
membangun 26 Agustus 2020
buildopts --prefix = --prefix = / snap / emacs / current / usr --with-xwidgets --with-x-toolkit = gtk3 --without-xaw3d --with-modules --with-cairo 'CFLAGS = - isystem / build / emacs / parts / emacs / install / usr / include -O2 '' CPPFLAGS = -isystem / build / emacs / parts / emacs / install / usr / include '' LDFLAGS = -L / build / emacs / parts / emacs / install / lib -L / build / emacs / parts / emacs / install / usr / lib -L / build / emacs / parts / emacs / install / lib / x86_64-linux-gnu -L / build / emacs / parts / emacs / install / usr / lib / x86_64-linux-gnu '
fitur XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB PEMBERITAHUAN INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS LCDSON GMODSON X11 X11XPERGETRE
sifat (envvar-file)
DOOM dir ~ / .doom.d /
versi 2.0.9
build dicangkok, HEAD -> kembangkan, asal / kembangkan, asal / HEAD 1456108 2020-09-10 18:03:32 -0400
file-elc 0
modul (: perusahaan penyelesaian ivy: ui doom doom-dashboard doom-berhenti hl-todo modeline ophints (popup + defaults) vc-gutter vi-tilde-fringe ruang kerja: editor (jahat + di mana-mana) file-templates cuplikan lipat: emacs dired electric batalkan vc: checkers sintaks: alat (eval + overlay) pencarian lsp magit: lang emacs-lisp (go + lsp) penurunan harga org sh: config (default + binding + smartparens))
paket (n / a)
lepas pin (t / a)
elpa (n / a)

Saat memulai debug dengan mode doom-debug, saya mendapatkan kesalahan ini. Saya telah menggunakan gopl dengan spacemac tanpa masalah.


Kesalahan

 Kesalahan dalam pre-command-hook (evil-repeat-pre-hook): (salah-type-argument number-or-marker-p "menjelaskan-pause-report-measure-bug (\" bukan level teratas dalam wrap-native untuk #nihil t 0,01)
 terapkan (jelaskan-jeda - bungkus-asli #(nihil t 0,01))
 baca-acara (nihil t 0,01)
 duduk-untuk (0,01)
 evil-esc ((keymap (91 keymap (53 keymap (126. [sebelum]) (59 keymap (50 keymap (126. [S-prior])))) (54 keymap (126. [next]) (59 keymap (50 peta kunci (126. [S-next])))) (49 peta kunci (59 k $
 ")
 ESC menjelaskan-jeda-laporan-mengukur-bug ("bukan tingkat teratas dalam bungkus-asli untuk #nihil t 0,01)
 terapkan (jelaskan-jeda - bungkus-asli #(nihil t 0,01))
 baca-acara (nihil t 0,01)
 duduk-untuk (0,01)
 evil-esc ((keymap (91 keymap (53 keymap (126. [sebelum]) (59 keymap (50 keymap (126. [S-prior])))) (54 keymap (126. [next]) (59 keymap (50 peta kunci (126. [S-next])))) (49 peta kunci (59 k $
 tidak ditentukan

Oke, sekarang berhasil. Sepertinya di Doom Anda harus berada dalam sebuah proyek, di Spacemacs sepertinya tidak berhasil.

Apakah halaman ini membantu?
0 / 5 - 0 peringkat