Open Navyashree0923 opened 2 years ago
related PR was https://github.com/emacs-lsp/lsp-mode/pull/3563 and it has been merged
Hello @yyoncho I have created a file lsp-camel.el. I have placed this file under "~/.emacs.d/elpa/lsp-mode-8.0.0".
This is the content my lsp-camel.el file.
;;; lsp-camel.el --- LSP Camel server integration -*- lexical-binding: t; -*-
;;; Code:
(require 'lsp-mode)
(defgroup lsp-camel nil
"LSP support for Camel, using camel-language-server"
:group 'lsp-mode
:tag "Language Server"
:package-version '(lsp-mode . "8.0.0"))
;; Define a variable to store camel language server jar version
(defconst lsp-camel-jar-version "1.5.0")
;; Define a variable to store camel language server jar name
(defconst lsp-camel-jar-name (format "camel-lsp-server-%s.jar" lsp-camel-jar-version))
;; Directory in which the servers will be installed. Lsp Server Install Dir: ~/.emacs.d/.cache/camells
(defcustom lsp-camel-jar-file (f-join lsp-server-install-dir "camells" lsp-camel-jar-name)
"Camel Language server jar command."
:type 'string
:group 'lsp-camel
:type 'file
:package-version '(lsp-mode . "8.0.0"))
(defcustom lsp-camel-jar-download-url
(format "https://repo1.maven.org/maven2/com/github/camel-tooling/camel-lsp-server/%s/%s" lsp-camel-jar-version lsp-camel-jar-name)
"Automatic download url for lsp-camel."
:type 'string
:group 'lsp-camel
:package-version '(lsp-mode . "8.0.0"))
(lsp-dependency
'camells
'(:system lsp-camel-jar-file)
`(:download :url lsp-camel-jar-download-url
:store-path lsp-camel-jar-file))
(defcustom lsp-camel-server-command `("java" "-jar" , lsp-camel-jar-file)
"Camel server command."
:type '(repeat string)
:group 'lsp-camel
:package-version '(lsp-mode . "8.0.0"))
(defun lsp-camel--create-connection ()
(lsp-stdio-connection
(lambda () lsp-camel-server-command)
(lambda () (f-exists? lsp-camel-jar-file))))
(lsp-register-client
(make-lsp-client :new-connection (lsp-camel--create-connection)
:activation-fn (lsp-activate-on "xml" "java" "spring-boot-properties-yaml")
:priority 0
:server-id 'camells
:add-on? t
:multi-root t
:initialized-fn (lambda (workspace)
(with-lsp-workspace workspace
(lsp--set-configuration (lsp-configuration-section "camel"))))
:download-server-fn (lambda (_client callback error-callback _update?)
(lsp-package-ensure 'camells callback error-callback))))
(lsp-consistency-check lsp-camel)
(provide 'lsp-camel)
;;; lsp-camel.el ends here
I have created init.el file.
This is the content my init.el file.
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
(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.
'(package-selected-packages '(yaml java-imports lsp-mode)))
(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.
)
(setq auto-mode-alist
(cons '("\\.yaml$" . yaml-mode) auto-mode-alist))
(require 'lsp-mode)
(add-hook 'nxml-mode-hook #'lsp)
(require 'lsp-mode)
(add-hook 'java-mode-hook #'lsp)
(require 'lsp-mode)
(add-hook 'yaml-mode-hook #'lsp)
I was able to successfully provide Text Editing capabilities of Camel URI with Camel JAVA and XML. But I'm trying for Yaml with the above mentioned files. I'm not able to see any editing capabilities for Yaml.
Please is there any sequence of steps that I should follow in order to achieve this task?
It is a follow up of this previous issue #3528 is covering camel Xml DSL. This issue is related to Camel Java DSL with the Camel language server. I would provide a Pull Request soon