feat: initial commit
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
# -*- mode: sh; -*-
|
||||||
|
watch_file flake.nix
|
||||||
|
watch_file flake.lock
|
||||||
|
if ! use flake . --no-pure-eval
|
||||||
|
then
|
||||||
|
echo "dev shell could not be built. The environment was not loaded. Make the necessary changes to flake.nix and hit enter to try again." >&2
|
||||||
|
fi
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
# ---> Emacs
|
||||||
|
# -*- mode: gitignore; -*-
|
||||||
|
*~
|
||||||
|
\#*\#
|
||||||
|
/.emacs.desktop
|
||||||
|
/.emacs.desktop.lock
|
||||||
|
*.elc
|
||||||
|
auto-save-list
|
||||||
|
tramp
|
||||||
|
.\#*
|
||||||
|
|
||||||
|
# Org-mode
|
||||||
|
.org-id-locations
|
||||||
|
*_archive
|
||||||
|
|
||||||
|
# flymake-mode
|
||||||
|
*_flymake.*
|
||||||
|
|
||||||
|
# eshell files
|
||||||
|
/eshell/history
|
||||||
|
/eshell/lastdir
|
||||||
|
|
||||||
|
# elpa packages
|
||||||
|
/elpa/
|
||||||
|
|
||||||
|
# reftex files
|
||||||
|
*.rel
|
||||||
|
|
||||||
|
# AUCTeX auto folder
|
||||||
|
/auto/
|
||||||
|
|
||||||
|
# cask packages
|
||||||
|
.cask/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# Flycheck
|
||||||
|
flycheck_*.el
|
||||||
|
|
||||||
|
# server auth directory
|
||||||
|
/server/
|
||||||
|
|
||||||
|
# projectiles files
|
||||||
|
.projectile
|
||||||
|
|
||||||
|
# directory configuration
|
||||||
|
.dir-locals.el
|
||||||
|
|
||||||
|
# network security
|
||||||
|
/network-security.data
|
||||||
|
|
||||||
|
# Eask
|
||||||
|
.eask/
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
;; -*- mode: eask; lexical-binding: t -*-
|
||||||
|
|
||||||
|
(package "lsp-typst"
|
||||||
|
"1.0.0"
|
||||||
|
"LSP support for Typst with lsp-mode")
|
||||||
|
|
||||||
|
(website-url "https://labs.phundrak.com/phundrak/lsp-typst")
|
||||||
|
(keywords "typst" "lsp" "tools")
|
||||||
|
|
||||||
|
(package-file "lsp-typst.el")
|
||||||
|
|
||||||
|
(script "test" "echo \"Error: no test specified\" && exit 1")
|
||||||
|
|
||||||
|
(source "gnu")
|
||||||
|
(source "nongnu")
|
||||||
|
(source "melpa")
|
||||||
|
|
||||||
|
(depends-on "emacs" "30.1")
|
||||||
|
(depends-on "f" "0.20")
|
||||||
|
(depends-on "lsp-mode" "10.0")
|
||||||
Generated
+61
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731533236,
|
||||||
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1783224372,
|
||||||
|
"narHash": "sha256-8i/87eeoqiGE4yOTjwSA3Eh/ziJRQEmd/unYU+K27sk=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d407951447dcd00442e97087bf374aad70c04cea",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
description = "LSP support for Typst with lsp-mode";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
}:
|
||||||
|
flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"] (system: let
|
||||||
|
pkgs = import nixpkgs {inherit system;};
|
||||||
|
in {
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
name = "lsp-typst";
|
||||||
|
buildInputs = [pkgs.eask-cli];
|
||||||
|
shellHook = ''
|
||||||
|
echo "lsp-typst devshell — Eask version: $(eask --version 2>/dev/null || echo 'not found')"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
+114
@@ -0,0 +1,114 @@
|
|||||||
|
;;; lsp-typst.el --- LSP support for Typst with lsp-mode -*- lexical-binding: t; colon-double-space: t; -*-
|
||||||
|
|
||||||
|
;; Author: Lucien Cartier-Tilet <lucien@phundrak.com>
|
||||||
|
;; Maintainer: Lucien Cartier-Tilet <lucien@phundrak.com>
|
||||||
|
;; Version: 1.0.0
|
||||||
|
;; Package-Requires: ((emacs "30.1") (lsp-mode "10") (f "0.20") (typst-ts-mode "0.12"))
|
||||||
|
;; Homepage: https://labs.phundrak.com/phundrak/lsp-typst
|
||||||
|
;; Keywords: lsp typst tools
|
||||||
|
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs
|
||||||
|
|
||||||
|
;; This program is free software: you can redistribute it and/or modify
|
||||||
|
;; it under the terms of the GNU General Public License as published by
|
||||||
|
;; the Free Software Foundation, either version 3 of the License, or
|
||||||
|
;; (at your option) any later version.
|
||||||
|
|
||||||
|
;; This program is distributed in the hope that it will be useful,
|
||||||
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
;; GNU General Public License for more details.
|
||||||
|
|
||||||
|
;; You should have received a copy of the GNU General Public License
|
||||||
|
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; LSP support for Typst with lsp-mode.
|
||||||
|
;;
|
||||||
|
;; I recommend `typst-ts-mode'
|
||||||
|
;; (https://codeberg.org/meow_king/typst-ts-mode/), available on
|
||||||
|
;; Nongnu Elpa, if you need a major mode for Typst, but this package
|
||||||
|
;; does not require it.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'lsp-mode)
|
||||||
|
(require 'f)
|
||||||
|
|
||||||
|
(defgroup lsp-typst nil
|
||||||
|
"Settings for the tinymist language server client for Typst."
|
||||||
|
:group 'lsp-mode
|
||||||
|
:link '(url "https://github.com/Myriad-Dreamin/tinymist")
|
||||||
|
:package-version '(lsp-typst . "1.0.0"))
|
||||||
|
|
||||||
|
(defcustom lsp-typst-server-command "tinymist"
|
||||||
|
"The binary or full path to binary which launches the server."
|
||||||
|
:type 'string
|
||||||
|
:group 'lsp-typst
|
||||||
|
:package-version '(lsp-typst . "1.0.0"))
|
||||||
|
|
||||||
|
(defcustom lsp-typst-server-command-args '("lsp")
|
||||||
|
"Command-line arguments for the tinymist LSP server."
|
||||||
|
:type '(repeat string)
|
||||||
|
:group 'lsp-typst
|
||||||
|
:package-version '(lsp-typst . "1.0.0"))
|
||||||
|
|
||||||
|
(defcustom lsp-typst-download-url
|
||||||
|
(format "https://github.com/Myriad-Dreamin/tinymist/releases/latest/download/tinymist-%s"
|
||||||
|
(let ((aarch64-p (string-match "^aarch64-.*" system-configuration)))
|
||||||
|
(pcase system-type
|
||||||
|
('gnu/linux (if aarch64-p "linux-arm64" "linux-x64"))
|
||||||
|
('darwin (if aarch64-p "darwin-arm64" "darwin-x64"))
|
||||||
|
('windows-nt (if aarch64-p "win32-arm64.exe" "win32-x64.exe")))))
|
||||||
|
"Automatic download URL for tinymist.
|
||||||
|
|
||||||
|
Out of the box, supports x86-64 GNU/Linux, Windows, and macOS. If you
|
||||||
|
are using Linux with musl, a non-aarch64 ARM architecture, or if you
|
||||||
|
want tinymist-preview, you’ll probably want to change this value."
|
||||||
|
:type 'string
|
||||||
|
:group 'lsp-typst
|
||||||
|
:package-version '(lsp-typst . "1.0.0"))
|
||||||
|
|
||||||
|
(defcustom lsp-typst-store-path (f-join lsp-server-install-dir
|
||||||
|
"tinymist"
|
||||||
|
(if (eq system-type 'windows-nt)
|
||||||
|
"tinymist.exe"
|
||||||
|
"tinymist"))
|
||||||
|
"The path to the file in which `tinymist' will be stored."
|
||||||
|
:type 'string
|
||||||
|
:group 'lsp-typst
|
||||||
|
:package-version '(lsp-typst . "1.0.0"))
|
||||||
|
|
||||||
|
(add-to-list 'lsp-language-id-configuration '(typst-ts-mode . "typst"))
|
||||||
|
|
||||||
|
(lsp-dependency 'typst
|
||||||
|
'(:system "typst")
|
||||||
|
`(:download :url lsp-typst-download-url
|
||||||
|
:store-path lsp-typst-store-path
|
||||||
|
:set-executable? t))
|
||||||
|
|
||||||
|
(lsp-register-client
|
||||||
|
(make-lsp-client :new-connection (lsp-stdio-connection
|
||||||
|
(lambda ()
|
||||||
|
(cons (or (executable-find lsp-typst-server-command)
|
||||||
|
(lsp-package-path 'typst)
|
||||||
|
"tinymist")
|
||||||
|
lsp-typst-server-command-args)))
|
||||||
|
:major-mode 'nix-ts-mode
|
||||||
|
:activation-fn (lsp-activate-on "typst")
|
||||||
|
:initialized-fn (lambda (workspace)
|
||||||
|
(with-lsp-workspace workspace
|
||||||
|
(lsp--set-configuration (lsp-configuration-section "typst"))))
|
||||||
|
:priority -1
|
||||||
|
:server-id 'typst
|
||||||
|
:download-server-fn (lambda (_client callback error-callback _update?)
|
||||||
|
(lsp-package-ensure 'typst callback error-callback))))
|
||||||
|
|
||||||
|
(lsp-consistency-check lsp-typst)
|
||||||
|
|
||||||
|
(provide 'lsp-typst)
|
||||||
|
|
||||||
|
;;; lsp-typst.el ends here
|
||||||
Reference in New Issue
Block a user