purcell / emacs.d

An Emacs configuration bundle with batteries included
BSD 2-Clause "Simplified" License
6.84k stars 2.05k forks source link

After saving a file for the fisrt time, syntax errors will not be highlight omitted till the next save. also autocompleteing will not work. #809

Closed masalkhi closed 2 years ago

masalkhi commented 2 years ago

Everything is working perfectly, until saving a file for the first time, the syntax errors will not be highlight or omitted until typing C-x C-s . also the auto-completion will not work after the first save. any any suggestions how I to solve this.

before the first save, everything is good: Screenshot from 2022-05-04 10-24-08

now saving for the fist time and after that removing the text, the highlighting will not be omitted: Screenshot from 2022-05-04 10-26-06

typing C-x C-s and after that the highlighted syntax errors will be omitted: Screenshot from 2022-05-04 10-26-19

writing some text (no syntax error will show) Screenshot from 2022-05-04 10-26-40

typing C-x C-s again and all the syntax errors will be highlighted

Screenshot from 2022-05-04 10-26-51

The workspace directory of the jdtls is the same for the eclipse IDE installed on my PC.

and if there is a way to import an already existed maven project to lsp-java I would appreciate.

GNU Emacs 26.3

Linux 5.13.0-40-generic #45~20.04.1-Ubuntu SMP x86_64 GNU/Linux

the init.el file:


;; inhibit the splash screen
(setq inhibit-splash-screen t)

;; setting the window in the middle but wider
(setq initial-frame-alist '((top . 10) (left . 185)
                           (width . 110) (height . 50)))

;;hiding the tool bar
(tool-bar-mode -1)

;; auto-closing brackets 
(electric-pair-mode 1)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(c-default-style
   (quote
    ((c-mode . "linux")
     (java-mode . "linux")
     (awk-mode . "awk")
     (other . "gnu"))))
 '(lsp-java-workspace-dir "/home/abd/eclipse-workspace/")
 '(package-selected-packages
   (quote
    (helm-lsp which-key lsp-ui company flycheck projectile use-package web-mode prettier mvn multiple-cursors lsp-javacomp lsp-java js2-mode gradle-mode emmet-mode eclim))))

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)

;; Add color formatting to *compilation* buffer
(add-hook 'compilation-filter-hook
   (lambda () (ansi-color-apply-on-region (point-min) (point-max))))

(require 'emmet-mode)

;; Auto-start on any markup modes
(add-hook 'sgml-mode-hook 'emmet-mode)

;; enable Emmet's css abbreviation.
(add-hook 'css-mode-hook  'emmet-mode) 

;; enable Emmet's nxml abbreviation.
(add-hook 'nxml-mode-hook  'emmet-mode) 

(add-hook 'lsp-mode-hook
      (lambda ()
        (local-set-key [?\M-\r] 'lsp-execute-code-action)))

(add-hook 'lsp-mode-hook
      (lambda ()
        (local-set-key [?\M-b] 'lsp-java-build-project)))

(global-set-key [?\M-c] 'compile)

(global-set-key (kbd "<C-dead-circumflex>") 'treemacs)

;; multiple-cursors
(require 'multiple-cursors)

(condition-case nil
    (require 'use-package)
  (file-error
   (require 'package)
   (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
   (package-initialize)
   (package-refresh-contents)
   (package-install 'use-package)
   (setq use-package-always-ensure t)
   (require 'use-package)))

(use-package projectile)
(use-package flycheck)
(use-package yasnippet :config (yas-global-mode))
(use-package lsp-mode :hook ((lsp-mode . lsp-enable-which-key-integration))
  :config (setq lsp-completion-enable-additional-text-edit nil))
(use-package hydra)
(use-package company)
(use-package lsp-ui)
(use-package which-key :config (which-key-mode))
(use-package lsp-java :config (add-hook 'java-mode-hook 'lsp))
(use-package dap-mode :after lsp-mode :config (dap-auto-configure-mode))
(use-package dap-java :ensure nil)
(use-package helm-lsp)
(use-package helm
  :config (helm-mode))
(use-package lsp-treemacs)
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
masalkhi commented 2 years ago

Sorry! I have posted this entry in the wrong place, I wanted to post it in the lsp-java repository

purcell commented 2 years ago

Haha, no worries — hope you figure it out