Giter Site home page Giter Site logo

tokiwa-software / fuzion-lsp-server Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 2.0 1.66 MB

A language server implementation for Fuzion

License: GNU General Public License v3.0

Makefile 1.84% Java 97.88% Shell 0.28%
lsp-server lsp lsp-mode programming-languages emacs fuzion

fuzion-lsp-server's Introduction

fuzion logo A language server implementation for Fuzion



Requirements

  • java version 21 or higher
  • GNU-Make
  • wget

Build

  • run make jar which should produce an out.jar file

Install

Client Repository
vscode https://github.com/tokiwa-software/vscode-fuzion
vim see instructions below
emacs see instructions below
eclipse (theia) https://github.com/tokiwa-software/vscode-fuzion

Vim

Vim

  1. Note: fuzion_language_server (from ./bin/) needs to be in $PATH

  2. Example .vimrc:

    :filetype on
    
    call plug#begin('~/.vim/plugged')
    Plug 'neoclide/coc.nvim', {'branch': 'release'}
    call plug#end()
  3. in vim

    1. :PlugInstall

    2. :CocConfig

      {
        "languageserver": {
          "fuzion": {
            "command": "fuzion_language_server",
            "args" : ["-stdio"],
            "filetypes": [
              "fz",
              "fuzion"
            ]
          }
        }
      }
  4. add filetype-detection file ~/.vim/ftdetect/fz.vim

    au BufRead,BufNewFile *.fz            set filetype=fz

Emacs

Emacs

fuzion_language_server (from ./bin/) needs to be in $PATH

For emacs there is two options eglot or lsp-mode.

Eglot

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("elpa" . "https://elpa.gnu.org/packages/"))
;; 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.
 '(inhibit-startup-screen t)
 '(package-selected-packages '(eglot ##)))
(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.
 )

(define-derived-mode fuzion-mode
  fundamental-mode "Fuzion"
  "Major mode for Fuzion.")

(add-to-list 'auto-mode-alist '("\\.fz\\'" . fuzion-mode))

(require 'eglot)

(add-to-list 'eglot-server-programs
             '(fuzion-mode . ("fuzion_language_server" "-stdio")))

(add-hook 'after-init-hook 'global-company-mode)
(add-hook 'fuzion-mode-hook 'eglot-ensure)

(provide 'init)
;;; init.el ends here
  • add following line to ~/.emacs.d/init.el or to ~/.emacs

    (load "~/.emacs.d/fuzion-lsp.el")

LSP-Mode

  • install lsp-mode, flycheck and company for emacs using
    • M-x package-install RET lsp-mode
    • M-x package-install RET flycheck
    • M-x package-install RET company RET
  • add the following code to ~/.emacs.d/fuzion-lsp.el to enable https://github.com/emacs-lsp/lsp-mode
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("elpa" . "https://elpa.gnu.org/packages/"))
(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.
 '(inhibit-startup-screen t)
 '(package-selected-packages '(lsp-ui company flycheck 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.
 )

(define-derived-mode fuzion-mode
  fundamental-mode "Fuzion"
  "Major mode for Fuzion.")

(add-to-list 'auto-mode-alist '("\\.fz\\'" . fuzion-mode))

(require 'lsp-mode)
(global-flycheck-mode)
(add-to-list 'lsp-language-id-configuration '(fuzion-mode . "fuzion"))

(defgroup lsp-fuzionlsp nil
  "LSP support for Fuzion, using fuzionlsp."
  :group 'lsp-mode
  :link '(url-link ""))

(lsp-register-client
 (make-lsp-client :new-connection (lsp-stdio-connection  (lambda ()
                                                          `(,"fuzion_language_server"
                                                            "-stdio")))
                  :major-modes '(fuzion-mode)
                  :priority -1
                  :server-id 'fuzionls))


(lsp-consistency-check lsp-fuzion)

(add-hook 'fuzion-mode-hook #'lsp)
(add-hook 'after-init-hook 'global-company-mode)

(setq lsp-enable-symbol-highlighting t)

;; (setq  lsp-enable-semantic-highlighting t
;;        lsp-semantic-tokens-enable t
;;        lsp-semantic-tokens-warn-on-missing-face t
;;        lsp-semantic-tokens-apply-modifiers nil
;;        lsp-semantic-tokens-allow-delta-requests nil
;;        lsp-semantic-tokens-allow-ranged-requests nil)

;; (setq lsp-modeline-code-actions-mode t)

;; (setq lsp-modeline-code-actions-segments '(name icon))

;; (setq lsp-log-io t)

(provide 'lsp-fuzion)

(provide 'init)
;;; init.el ends here
  • add following line to ~/.emacs.d/init.el or to ~/.emacs

    (load "~/.emacs.d/fuzion-lsp.el")

Run standalone

Transport socket

  • run ./bin/fuzion_language_server -socket --port=3000
  • connect the client to the (random) port the server prints to stdout.

Transport stdio

  • run ./bin/fuzion_language_server -stdio

Debug

  • make debug

Test

  • make run_tests

Profiling

  • make profile/tests or profile/tagged_tests

Implementation state

Feature Status
diagnostics
completion
hover
signatureHelp
declaration
definition
typeDefinition
implementation
references
documentHighlight
documentSymbol
codeAction
codeLens
documentLink
documentColor
colorPresentation
formatting
rangeFormatting
onTypeFormatting
rename
prepareRename
foldingRange
selectionRange
prepareCallHierarchy
callHierarchy incoming
callHierarchy outgoing
semantic tokens
linkedEditingRange
moniker
inlayHints
inlineValue
type hierarchy
notebook document support

fuzion-lsp-server's People

Contributors

fridis avatar maxteufel avatar michaellilltokiwa avatar miclill avatar

Stargazers

 avatar

fuzion-lsp-server's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.