all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: lester <lester29@gazeta.pl>
To: help-gnu-emacs@gnu.org
Subject: Need help with autocompletion with company and lsp-mode
Date: Tue, 4 Apr 2023 06:30:51 +0200	[thread overview]
Message-ID: <dc122094-58f9-c05a-810b-020d3beabcf3@gazeta.pl> (raw)

Hey

I've an problem with auto completion not working. I tested it in the 
different file modes like Emacs Lisp and C++.

Any help is appreciated.

My config:

;;; init.el --- my gnu emacs config
;;; Commentary:

;;; Code:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; use straight.el for package management
(defvar bootstrap-version)
(let ((bootstrap-file
        (expand-file-name "straight/repos/straight.el/bootstrap.el" 
user-emacs-directory))
       (bootstrap-version 6))
   (unless (file-exists-p bootstrap-file)
     (with-current-buffer
         (url-retrieve-synchronously
 
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
          'silent 'inhibit-cookies)
       (goto-char (point-max))
       (eval-print-last-sexp)))
   (load bootstrap-file nil 'nomessage))

;; install use-package using straight.el
(straight-use-package 'use-package)

;; configure use-package to use straight.el by default
(use-package straight
   :custom
   (straight-use-package-by-default t))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; utf-8 everywhere
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;; backwards compatibility as default-buffer-file-coding-system
;; is deprecated in 23.2.
(if (boundp 'buffer-file-coding-system)
     (setq-default buffer-file-coding-system 'utf-8)
   (setq default-buffer-file-coding-system 'utf-8))

;; Treat clipboard input as UTF-8 string first; compound text next, etc.
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; disable startup screen
(setq inhibit-startup-screen t)

;; disable menu bar, scroll bar, and tool bar
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)

;; disable dialog boxes
(setq use-dialog-box nil)

;; set custom color scheme
(use-package doom-themes)
(use-package doom-moonfly-theme
   :straight (:host github :repo "stackmystack/doom-moonfly-theme"
		   :branch "master"))
(load-theme 'doom-moonfly t)

;; set default font
(set-face-attribute 'default nil
		    :family "MesloLGS Nerd Font Mono"
		    :height 130
		    :weight 'normal
		    :width 'normal)

;; always ask using y or n instead yes or no
(defalias 'yes-or-no-p 'y-or-n-p)

;; disable annoying bell
(setq ring-bell-function 'ignore)

;; auto close bracket insertion
(electric-pair-mode 1)

;; display line numbers
(require 'display-line-numbers)

(defcustom display-line-numbers-exempt-modes
   '(vterm-mode eshell-mode shell-mode term-mode ansi-term-mode)
   "Major modes on which to disable line numbers."
   :group 'display-line-numbers
   :type 'list
   :version "green")

(defun display-line-numbers--turn-on ()
   "Turn on line numbers except for certain major modes.
Exempt major modes are defined in `display-line-numbers-exempt-modes'."
   (unless (or (minibufferp)
               (member major-mode display-line-numbers-exempt-modes))
     (display-line-numbers-mode)))

(global-display-line-numbers-mode)

;; C-x C-; is not properly handled in terminal emulator so let's
;; add custom key binding for toggling comments in line
(defun toggle-comment-on-line ()
   "Comment or uncomment current line."
   (interactive)
   (comment-or-uncomment-region (line-beginning-position) 
(line-end-position)))
(global-set-key (kbd "C-c ;") #'toggle-comment-on-line)

;; change indentation level for languages with C-like syntax
(setq-default c-basic-offset 4)

;; lsp-mode
(use-package lsp-mode
   :commands (lsp lsp-deferred)
   :custom
   (lsp-auto-guess-root t)
   (lsp-log-io t)
   (read-process-output-max (* 1024 1024))
   (lsp-idle-delay 0.5)
   (lsp-prefer-flymake nil))

;; company
(use-package company
   :after lsp-mode
   :bind
   (:map company-active-map
	("<tab>" . company-complete-selection))
   (:map lsp-mode-map
         ("<tab>" . company-indent-or-complete-common))
   :custom
   (company-minimum-prefix-length 1)
   (company-idle-delay 0.0) ;; default is 0.2
   :hook ((text-mode . company-mode)
          (prog-mode . company-mode)
          (org-mode . company-mode)
	 ;(company-mode . yas-minor-mode)))
	 (lsp-mode . company-mode)))

;; flycheck
(use-package flycheck
   :ensure t
   :init (global-flycheck-mode))

(use-package flycheck-color-mode-line)
(eval-after-load "flycheck"
   '(add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode))

(use-package flycheck-pos-tip)
(with-eval-after-load 'flycheck
   (flycheck-pos-tip-mode))

(add-to-list 'display-buffer-alist
              `(,(rx bos "*Flycheck errors*" eos)
               (display-buffer-reuse-window
                display-buffer-in-side-window)
               (side            . bottom)
               (reusable-frames . visible)
               (window-height   . 0.33)))

;; sudoers mode
(use-package etc-sudoers-mode)

;; systemd mode
(use-package systemd)

(provide 'init)
;;; init.el ends here



                 reply	other threads:[~2023-04-04  4:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dc122094-58f9-c05a-810b-020d3beabcf3@gazeta.pl \
    --to=lester29@gazeta.pl \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.