mirror of
https://github.com/zap-proto/lsp.git
synced 2026-10-30 15:04:44 +00:00
Finish the ZAP rebrand of the language server, completing the prior
config-id rename (capnp-ls-client -> zap-ls-client) with the binary,
project, default schema-compiler command, and release/download wiring.
- CMake: project() and exe_name capnp-ls -> zap-ls. Build now emits
build/zap-ls.
- compilation_manager.cpp: default compiler command "capnp" -> "zap";
suffix guard now accepts endsWith("zap") || endsWith("capnp") (back-
compat with a real capnp binary); version regex accepts "Zap version
X.Y" (emitted by the cpp-core fork, VERSION_STRING="Zap version")
as well as "Cap'n Proto version X.Y". Without the regex change the
version check would reject the zap binary and block all compilation.
- extension.ts: binaryName, downloadCapnpLs -> downloadZapLs, fallback
command + log strings, and download URL -> github.com/zap-proto/lsp
asset zap-ls-linux-x86_64.
- ci.yml: rename/upload/download/release artifact capnp-ls-linux-x86_64
-> zap-ls-linux-x86_64 and `mv build/zap-ls ...` so the artifact name
matches the extension's download URL and the new CMake output. The
ghcr.io/.../capnp-prebuilt-ubuntu libcapnp build image is preserved.
- package.json (x2), testFixture settings.json, README.md, samples/
README.md: repo URLs -> zap-proto/lsp; default compiler "capnp" ->
"zap"; binary path build/zap-ls; titles -> "ZAP Language Server".
Preserved (load-bearing libcapnp parser dependency): all #include
<capnp/...>/<kj/...>, capnp::/kj:: API calls, capnp_ls namespace,
find_package(CapnProto REQUIRED), CapnProto::capnp-rpc / capnp-json,
the USE_BUNDLED_CAPNP_TOOL ExternalProject block (capnproto.org 1.1.0,
BUNDLED_CAPNP_EXECUTABLE), the .capnp extension/alias/import refs, the
"capnp" initializationOptions key, and prose stating the server is
built on / wire-compatible with Cap'n Proto.
TODO (out of scope, flagged for follow-up): the `zap` binary is the
same brace-only cpp-core C++ fork; it does NOT yet parse the
whitespace-significant ZAP dialect. Switching the subprocess to `zap`
is necessary but not sufficient for whitespace .zap files. Full
whitespace symbol-resolution requires an INDENT/DEDENT lexer +
declaration-order ordinal inference in cpp-core/c++/src/zap/compiler
(lexer.c++ / parser.c++) emitting a correct CodeGeneratorRequest with
preserved SourceInfo byte offsets; the LSP's libcapnp usage
(symbol_resolver SchemaLoader::load on the binary graph) needs no
change once the binary parses the new syntax.
Build risk (CI): the C++ build (cmake + libcapnp 1.1.0) cannot be
verified here — no cmake/libcapnp in this environment. TypeScript
edits verified (downloadZapLs call/def match; isolated tsc parse clean
aside from pre-existing missing @types/node + vscode ambient types).
JSON files parse. Flag the C++ compile + the new release-asset name
for CI verification.
96 lines
2.8 KiB
CMake
96 lines
2.8 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project("zap-ls" CXX)
|
|
|
|
# 使用されるコンパイラの情報を表示
|
|
message(STATUS "C++ Compiler: ${CMAKE_CXX_COMPILER}")
|
|
message(STATUS "C++ Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
|
|
message(STATUS "C++ Compiler version: ${CMAKE_CXX_COMPILER_VERSION}")
|
|
message(STATUS "C++ flags: ${CMAKE_CXX_FLAGS}")
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(exe_name zap-ls)
|
|
|
|
option(USE_BUNDLED_CAPNP_TOOL "Use bundled (self-built) Cap'n Proto tool and library" OFF)
|
|
|
|
add_executable(${exe_name}
|
|
src/main.cpp
|
|
src/stdin_reader.cpp
|
|
src/stdout_writer.cpp
|
|
src/lsp_message_handler.cpp
|
|
src/lsp_types.cpp
|
|
src/utils.cpp
|
|
src/subprocess_runner.cpp
|
|
src/compilation_manager.cpp
|
|
src/symbol_resolver.cpp
|
|
src/compile_error_parser.cpp
|
|
)
|
|
|
|
if(USE_BUNDLED_CAPNP_TOOL)
|
|
include(ExternalProject)
|
|
|
|
set(CAPNP_VERSION 1.1.0)
|
|
set(CAPNP_INSTALL_DIR ${CMAKE_BINARY_DIR}/capnproto-${CAPNP_VERSION})
|
|
|
|
ExternalProject_Add(
|
|
capnproto_external
|
|
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
|
URL "https://capnproto.org/capnproto-c++-${CAPNP_VERSION}.tar.gz"
|
|
CONFIGURE_COMMAND ./configure --prefix=${CAPNP_INSTALL_DIR} --without-fibers
|
|
BUILD_COMMAND make -j6 check
|
|
INSTALL_COMMAND make install
|
|
BUILD_IN_SOURCE 1
|
|
)
|
|
|
|
set(CAPNP_INCLUDE_DIR ${CAPNP_INSTALL_DIR}/include)
|
|
set(CAPNP_LIB_DIR ${CAPNP_INSTALL_DIR}/lib)
|
|
set(CAPNP_EXECUTABLE ${CAPNP_INSTALL_DIR}/bin/capnp)
|
|
|
|
add_library(capnp STATIC IMPORTED)
|
|
set_target_properties(capnp PROPERTIES
|
|
IMPORTED_LOCATION ${CAPNP_LIB_DIR}/libcapnp.a
|
|
)
|
|
|
|
add_library(capnp-rpc STATIC IMPORTED)
|
|
set_target_properties(capnp-rpc PROPERTIES
|
|
IMPORTED_LOCATION ${CAPNP_LIB_DIR}/libcapnp-rpc.a
|
|
)
|
|
|
|
add_library(capnp-json STATIC IMPORTED)
|
|
set_target_properties(capnp-json PROPERTIES
|
|
IMPORTED_LOCATION ${CAPNP_LIB_DIR}/libcapnp-json.a
|
|
)
|
|
|
|
add_library(kj STATIC IMPORTED)
|
|
set_target_properties(kj PROPERTIES
|
|
IMPORTED_LOCATION ${CAPNP_LIB_DIR}/libkj.a
|
|
)
|
|
|
|
add_library(kj-async STATIC IMPORTED)
|
|
set_target_properties(kj-async PROPERTIES
|
|
IMPORTED_LOCATION ${CAPNP_LIB_DIR}/libkj-async.a
|
|
)
|
|
|
|
add_dependencies(${exe_name} capnproto_external)
|
|
target_include_directories(${exe_name} PRIVATE ${CAPNP_INCLUDE_DIR})
|
|
target_link_directories(${exe_name} PRIVATE ${CAPNP_LIB_DIR})
|
|
|
|
find_package(Threads)
|
|
target_link_libraries(${exe_name} PRIVATE
|
|
capnp-json
|
|
capnp-rpc
|
|
capnp
|
|
kj-async
|
|
kj
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
)
|
|
|
|
target_compile_definitions(${exe_name} PRIVATE BUNDLED_CAPNP_EXECUTABLE="${CAPNP_EXECUTABLE}")
|
|
else()
|
|
find_package(CapnProto REQUIRED)
|
|
|
|
target_link_libraries(${exe_name} PRIVATE
|
|
CapnProto::capnp-rpc
|
|
CapnProto::capnp-json
|
|
)
|
|
endif()
|