# Copyright © SixtyFPS GmbH <info@slint.dev>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial

[package]
name = "slint-lsp"
description = "A language server protocol implementation for Slint"
authors = ["Slint Developers <info@slint.dev>"]
edition.workspace = true
homepage = "https://slint.dev"
license.workspace = true
repository.workspace = true
rust-version.workspace = true
version = "1.3.1"
categories = ["gui", "development-tools", "command-line-utilities"]
keywords = ["lsp", "ui", "toolkit"]

[package.metadata.bundle]
name = "Slint Live Preview"
icon = ["../../logo/slint-logo-small-light.png"]

[[bin]]
name = "slint-lsp"
path = "main.rs"

[lib]
# lib is there only for the web
crate-type = ["cdylib"]
path = "wasm_main.rs"
# On windows building this package creates slint-lsp.exe and slint-lsp.dll.
# To avoid that both end up trying to create slint-lsp.pdb for their debug
# symbols, rename the lib.
name = "slint_lsp_wasm"

[features]
# Remove once MSRV > 1.70 (1.70 does not yet work!):
slint = []
backend-qt = ["slint/backend-qt", "preview"]

backend-winit = ["slint/backend-winit", "preview"]
backend-winit-x11 = ["slint/backend-winit-x11", "preview"]
backend-winit-wayland = ["slint/backend-winit-wayland", "preview"]
backend-linuxkms = ["slint/backend-linuxkms", "preview"]

renderer-femtovg = ["slint/renderer-femtovg", "preview"]
renderer-skia = ["slint/renderer-skia", "preview"]
renderer-skia-opengl = ["slint/renderer-skia-opengl", "preview"]
renderer-skia-vulkan = ["slint/renderer-skia-vulkan", "preview"]
renderer-software = ["slint/renderer-software", "preview"]

# Compat
backend-gl-all = ["backend-winit", "renderer-femtovg"]
backend-gl-wayland = ["backend-winit-wayland", "renderer-femtovg"]
backend-gl-x11 = ["backend-winit-x11", "renderer-femtovg"]
eventloop-qt = ["backend-qt"]
renderer-winit-qt = ["backend-qt"]
renderer-winit-femtovg = ["renderer-femtovg"]
renderer-winit-skia = ["renderer-skia"]
renderer-winit-skia-opengl= ["renderer-skia-opengl"]
renderer-winit-skia-vulkan= ["renderer-skia-vulkan"]
renderer-winit-software = ["renderer-software"]

## Enable support for previewing .slint files
preview = ["preview-builtin", "preview-external", "preview-engine"]
## [deprecated] Used to enable the "Show Preview" lenses and action on components.
preview-lense = []
## [deprecated] Used to enable partial support for external previewers.
## Use "preview-external" (and maybe "preview-engine" if you want the LSP binary
## to provide an implementation of the external preview API when building for WASM)
preview-api = ["preview-external"]
## Build in the actual code to act as a preview for slint files.
preview-engine = ["dep:slint", "dep:slint-interpreter", "dep:i-slint-core", "dep:i-slint-backend-selector", "dep:image", "dep:slint-build", "dep:i-slint-common"]
## Build in the actual code to act as a preview for slint files. Does nothing in WASM!
preview-builtin = ["preview-engine"]
## Support the external preview optionally used by e.g. the VSCode plugin
preview-external = []

default = ["backend-qt", "backend-winit", "renderer-femtovg", "preview"]

[dependencies]
i-slint-compiler = { workspace = true, features = ["default"] }

euclid = "0.22"
lsp-types = { version = "0.94.0", features = ["proposed"] }
rowan = "0.15.5"
serde = "1.0.118"
serde_json = "1.0.60"

# for the preview-engine feature
i-slint-backend-selector = { workspace = true, features = ["default"], optional = true }
i-slint-common = { workspace = true, features = ["default"], optional = true }
i-slint-core = { workspace = true, features = ["std"], optional = true }
slint = { workspace = true, features = ["compat-1-2"], optional = true }
slint-interpreter = { workspace = true, features = ["compat-1-2", "highlight", "internal"], optional = true  }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
clap = { version = "4.0", features = ["derive", "wrap_help"] }
crossbeam-channel = "0.5"  # must match the version used by lsp-server
lsp-server = "0.7"
once_cell = "1.9.0"

# Enable image-rs' default features to make all image formats available for the preview
image = { version = "0.24.0", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.5"
js-sys = { version = "0.3.57" }
send_wrapper = { workspace = true }
serde-wasm-bindgen = "0.6.0"
wasm-bindgen = "0.2.80"
wasm-bindgen-futures = "0.4.30"

[dev-dependencies]
spin_on = "0.1"

[build-dependencies]
slint-build = { workspace = true, features = ["default"], optional = true }

# [package.metadata.wasm-pack.profile.release]
# wasm-opt = false
