Skip to content

Commit

Permalink
fix: Expand Neovim configuration scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
slavek-kucera authored Apr 5, 2024
1 parent dc43d9a commit d5b341e
Show file tree
Hide file tree
Showing 18 changed files with 121 additions and 67 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:
- name: Prepare UI tests
run: |
mkdir -p ${{ env.CLIENT_DIR }}/bin/linux_x64
cp build/bin/language_server ${{ env.CLIENT_DIR }}/bin/linux_x64/language_server
cp build/bin/hlasm_language_server ${{ env.CLIENT_DIR }}/bin/linux_x64/hlasm_language_server
- name: Run UI tests
run: |
npm ci
Expand Down Expand Up @@ -197,13 +197,13 @@ jobs:
- os: ubuntu-22.04
native: linux_x64
container: alpine:3.16
dbg-strip: objcopy --only-keep-debug language_server language_server.dbg && objcopy --strip-unneeded language_server && objcopy --add-gnu-debuglink=language_server.dbg language_server
dbg-pattern: build/bin/language_server.dbg
dbg-strip: objcopy --only-keep-debug hlasm_language_server hlasm_language_server.dbg && objcopy --strip-unneeded hlasm_language_server && objcopy --add-gnu-debuglink=hlasm_language_server.dbg hlasm_language_server
dbg-pattern: build/bin/hlasm_language_server.dbg
- os: ubuntu-22.04
native: linux_arm64
container: alpine:3.19
dbg-strip: aarch64-linux-musl-objcopy --only-keep-debug language_server language_server.dbg && aarch64-linux-musl-objcopy --strip-unneeded language_server && aarch64-linux-musl-objcopy --add-gnu-debuglink=language_server.dbg language_server
dbg-pattern: build/bin/language_server.dbg
dbg-strip: aarch64-linux-musl-objcopy --only-keep-debug hlasm_language_server hlasm_language_server.dbg && aarch64-linux-musl-objcopy --strip-unneeded hlasm_language_server && aarch64-linux-musl-objcopy --add-gnu-debuglink=hlasm_language_server.dbg hlasm_language_server
dbg-pattern: build/bin/hlasm_language_server.dbg
- os: ubuntu-22.04
native: wasm
container: emscripten/emsdk:3.1.46
Expand Down Expand Up @@ -267,13 +267,13 @@ jobs:
- name: Actions artifact
uses: actions/upload-artifact@v4
with:
name: language_server_${{ matrix.native }}
path: build/bin/language_server${{ matrix.artifacts-ext }}
name: hlasm_language_server_${{ matrix.native }}
path: build/bin/hlasm_language_server${{ matrix.artifacts-ext }}
- name: Actions artifact
if: ${{ matrix.dbg-pattern }}
uses: actions/upload-artifact@v4
with:
name: language_server_${{ matrix.native }}_dbg
name: hlasm_language_server_${{ matrix.native }}_dbg
path: ${{ matrix.dbg-pattern }}

test-matrix:
Expand Down Expand Up @@ -322,16 +322,16 @@ jobs:
- name: Download native language server
uses: actions/download-artifact@v4
with:
name: language_server_${{ matrix.native }}
name: hlasm_language_server_${{ matrix.native }}
path: ${{ env.CLIENT_DIR }}/bin/${{ matrix.native }}/
- name: Download wasm language server
uses: actions/download-artifact@v4
with:
name: language_server_wasm
name: hlasm_language_server_wasm
path: ${{ env.CLIENT_DIR }}/bin/wasm/
- name: Set executable flag
if: ${{ matrix.chmod }}
run: chmod +x bin/${{ matrix.native }}/language_server
run: chmod +x bin/${{ matrix.native }}/hlasm_language_server
- name: Setup emulation
if: ${{ hashFiles(format('scripts/emulation.{0}.sh', matrix.native)) != '' }}
run: ../../scripts/emulation.${{ matrix.native }}.sh
Expand All @@ -353,7 +353,7 @@ jobs:
- name: Download wasm language server
uses: actions/download-artifact@v4
with:
name: language_server_wasm
name: hlasm_language_server_wasm
path: ${{ env.CLIENT_DIR }}/bin/wasm/
- name: Download Release Info
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -390,48 +390,48 @@ jobs:
- name: Download windows language server (x64)
uses: actions/download-artifact@v4
with:
name: language_server_win32_x64
name: hlasm_language_server_win32_x64
path: ${{ env.CLIENT_DIR }}/bin/win32_x64/
- name: Download windows language server (arm64)
uses: actions/download-artifact@v4
with:
name: language_server_win32_arm64
name: hlasm_language_server_win32_arm64
path: ${{ env.CLIENT_DIR }}/bin/win32_arm64/
- name: Download linux language server (x64)
uses: actions/download-artifact@v4
with:
name: language_server_linux_x64
name: hlasm_language_server_linux_x64
path: ${{ env.CLIENT_DIR }}/bin/linux_x64/
- name: Download linux language server (arm64)
uses: actions/download-artifact@v4
with:
name: language_server_linux_arm64
name: hlasm_language_server_linux_arm64
path: ${{ env.CLIENT_DIR }}/bin/linux_arm64/
- name: Download wasm language server
uses: actions/download-artifact@v4
with:
name: language_server_wasm
name: hlasm_language_server_wasm
path: ${{ env.CLIENT_DIR }}/bin/wasm/
- name: Download MacOS language server (x64)
uses: actions/download-artifact@v4
with:
name: language_server_darwin_x64
name: hlasm_language_server_darwin_x64
path: ${{ env.CLIENT_DIR }}/bin/darwin_x64/
- name: Download MacOS language server (arm64)
uses: actions/download-artifact@v4
with:
name: language_server_darwin_arm64
name: hlasm_language_server_darwin_arm64
path: ${{ env.CLIENT_DIR }}/bin/darwin_arm64/
- name: Download Release Info
uses: actions/download-artifact@v4
with:
name: release-info
- name: Set executable flag
run: |
chmod +x ${{ env.CLIENT_DIR }}/bin/darwin_x64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/darwin_arm64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/linux_x64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/linux_arm64/language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/darwin_x64/hlasm_language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/darwin_arm64/hlasm_language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/linux_x64/hlasm_language_server
chmod +x ${{ env.CLIENT_DIR }}/bin/linux_arm64/hlasm_language_server
- name: NPM CI
run: npm ci
working-directory: ${{ env.CLIENT_DIR }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Sonarcloud-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- name: Merge raw profiles
run: cd build/bin && llvm-profdata-14 merge -o hlasm_profile language.rawprof library.rawprof server.rawprof utils.rawprof
- name: Generate lcov coverage
run: cd build/bin && llvm-cov-14 show -instr-profile hlasm_profile language_server -object library_test -object server_test -object hlasm_utils_test > ../coverage.txt
run: cd build/bin && llvm-cov-14 show -instr-profile hlasm_profile hlasm_language_server -object library_test -object server_test -object hlasm_utils_test > ../coverage.txt
- name: Pull request event info
if: github.event_name == 'pull_request'
run: |
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "(gdb) Attach",
"type": "cppdbg",
"request": "attach",
"program": "${workspaceFolder}/build/bin/language_server",
"program": "${workspaceFolder}/build/bin/hlasm_language_server",
"processId": "${command:pickProcess}",
"MIMode": "gdb",
"setupCommands": [
Expand Down Expand Up @@ -43,7 +43,7 @@
"name": "Attach to proccess",
"type": "cppdbg",
"request": "attach",
"program": "${workspaceFolder}/build/bin/language_server",
"program": "${workspaceFolder}/build/bin/hlasm_language_server",
"processId":"${command:pickProcess}",
"MIMode": "gdb",
"setupCommands": [
Expand Down
34 changes: 34 additions & 0 deletions clients/neovim/filetype.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
-- Define hlasm FileType to Neovim
vim.filetype.add({
extension = {
hlasm = 'hlasm'
},
pattern = {
['.*/[Aa][Ss][Mm][Pp][Gg][Mm]/[^/]*'] = 'hlasm',
['.*/[Aa][Ss][Mm][Mm][Aa][Cc]/[^/]*'] = 'hlasm',
['.*%.asm'] = 'hlasm',
['.*%.asmmac'] = 'hlasm',
['.*%.asmpgm'] = 'hlasm',
['.*%.hlasm'] = 'hlasm',
['.*'] = {
priority = -math.huge,
function(path, bufnr)
local content = vim.api.nvim_buf_get_lines(bufnr, 0, 1000, false)
for i = 1, #content do
m, e = string.match(content[i], '^[ ]+[Mm][Aa][Cc][Rr][Oo] ')
if m ~= nil then
return 'hlasm'
end
m, e = string.match(content[i], '^[ ]+[Mm][Aa][Cc][Rr][Oo]$')
if m ~= nil then
return 'hlasm'
end
c, e = string.match(content[i], '^[.]?*')
if c == nil then
break
end
end
end
},
},
})
20 changes: 20 additions & 0 deletions clients/neovim/lspconfig.hlasm.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
local util = require 'lspconfig.util'

return {
default_config = {
cmd = { 'hlasm_language_server' },
filetypes = { 'hlasm' },
root_dir = util.root_pattern '.hlasmplugin',
single_file_support = true,
},
docs = {
description = [[
`hlasm_language_server` is a language server for the High Level Assembler language used on IBM SystemZ mainframes.
To learn how to configure the HLASM language server, see the [HLASM Language Support documentation](https://github.com/eclipse-che4z/che-che4z-lsp-for-hlasm).
]],
default_config = {
root_dir = [[root_pattern(".hlasmplugin")]],
},
},
}
6 changes: 3 additions & 3 deletions clients/neovim.lsp.lua → clients/neovim/sample.lsp.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
-- Sample Neovim LSP configuration
local hlasm_language_server_binary = '<<path to the language_server executable>>'
local client_id = vim.lsp.start({
name = 'hlasm-language-server',
cmd = {hlasm_language_server_binary},
filetypes = {'hlasm'},
cmd = { 'hlasm_language_server' }, -- path to the hlasm_language_server executable
filetypes = { 'hlasm' },
autostart = true,
root_dir = vim.fs.dirname(vim.fs.find({'.hlasmplugin'}, {upward = true})[1]),
})
Expand All @@ -15,6 +14,7 @@ vim.api.nvim_create_autocmd({'FileType'}, {
end
})

-- Define hlasm FileType to Neovim
vim.filetype.add({
extension = {
hlasm = 'hlasm'
Expand Down
8 changes: 4 additions & 4 deletions clients/vscode-hlasmplugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ else()
endif()

if(EMSCRIPTEN)
list(APPEND BIN_EXTRAS "$<TARGET_FILE_DIR:language_server>/language_server.js" "$<TARGET_FILE_DIR:language_server>/language_server.worker.js" "$<TARGET_FILE_DIR:language_server>/language_server.wasm")
list(APPEND BIN_EXTRAS "$<TARGET_FILE_DIR:hlasm_language_server>/hlasm_language_server.js" "$<TARGET_FILE_DIR:hlasm_language_server>/hlasm_language_server.worker.js" "$<TARGET_FILE_DIR:hlasm_language_server>/hlasm_language_server.wasm")
endif()


Expand Down Expand Up @@ -89,13 +89,13 @@ add_custom_command(
COMMAND
${COPY_ANTLR_LIBRARY_COMMAND}
COMMAND
${CMAKE_COMMAND} -E copy $<TARGET_FILE:language_server> ${BIN_EXTRAS} ${BIN_FOLDER}
${CMAKE_COMMAND} -E copy $<TARGET_FILE:hlasm_language_server> ${BIN_EXTRAS} ${BIN_FOLDER}
COMMAND
npx vsce package --no-dependencies -o ${GLOBAL_OUTPUT_PATH}/vscode-hlasmplugin.vsix
COMMAND
${CMAKE_COMMAND} -E touch ${CHECK_BUILD}
DEPENDS
${CHECK_CI} ${CMAKE_CURRENT_SOURCE_DIR} parser_library language_server
${CHECK_CI} ${CMAKE_CURRENT_SOURCE_DIR} parser_library hlasm_language_server
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
)
Expand All @@ -107,4 +107,4 @@ add_custom_target(vsix
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

add_dependencies(vsix language_server parser_library)
add_dependencies(vsix hlasm_language_server parser_library)
6 changes: 3 additions & 3 deletions clients/vscode-hlasmplugin/src/serverFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function generateServerOption(method: ServerVariant): Promise<vscodelc.Ser

//spawn the server
cp.execFile(
path.join(__dirname, '..', 'bin', langServerFolder, 'language_server'),
path.join(__dirname, '..', 'bin', langServerFolder, 'hlasm_language_server'),
decorateArgs([lspPort.toString()]));

return () => {
Expand All @@ -61,14 +61,14 @@ async function generateServerOption(method: ServerVariant): Promise<vscodelc.Ser
}
else if (method === 'native') {
const server: vscodelc.Executable = {
command: path.join(__dirname, '..', 'bin', langServerFolder, 'language_server'),
command: path.join(__dirname, '..', 'bin', langServerFolder, 'hlasm_language_server'),
args: decorateArgs(getConfig<string[]>('arguments', []))
};
return server;
}
else if (method === 'wasm') {
const server: vscodelc.NodeModule = {
module: path.join(__dirname, '..', 'bin', 'wasm', 'language_server'),
module: path.join(__dirname, '..', 'bin', 'wasm', 'hlasm_language_server'),
args: decorateArgs(getConfig<string[]>('arguments', [])),
options: { execArgv: getWasmRuntimeArgs() }
};
Expand Down
4 changes: 2 additions & 2 deletions clients/vscode-hlasmplugin/src/serverFactory.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function worker_main(extensionUri: string, hlasm_arguments: string[]) {
filereader.readAsDataURL(x);
});

Promise.all(['language_server.mjs', 'language_server.wasm', 'language_server.worker.js'].map(f => fetch(extensionUri + 'bin/wasm/' + f).then(x => x.blob()))).then(([main_blob, wasm_blob, worker_blob]) => {
Promise.all(['hlasm_language_server.mjs', 'hlasm_language_server.wasm', 'hlasm_language_server.worker.js'].map(f => fetch(extensionUri + 'bin/wasm/' + f).then(x => x.blob()))).then(([main_blob, wasm_blob, worker_blob]) => {
asDataUri(main_blob).then(main_text => import(main_text).then(m => m.default({
tmpQueue,
worker: self,
Expand All @@ -44,7 +44,7 @@ function worker_main(extensionUri: string, hlasm_arguments: string[]) {
if (path.endsWith(".wasm")) {
return URL.createObjectURL(wasm_blob);
}
else if (path.endsWith("language_server.worker.js")) {
else if (path.endsWith("hlasm_language_server.worker.js")) {
return URL.createObjectURL(worker_blob);
}
return path;
Expand Down
6 changes: 3 additions & 3 deletions clients/vscode-hlasmplugin/src/test/workspace/remote2.hlasm
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MACA
MACB
MACC
MACA
MACB
MACC
2 changes: 1 addition & 1 deletion docs/Build-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The project can be built for the WASM target using the Emscripten SDK. Currently

The project tests or the language server itself then needs to be run in the Node with several experimental features enabled.

node --experimental-wasm-threads --experimental-wasm-bulk-memory language_server.js
node hlasm_language_server.js

Mac OS
------
Expand Down
28 changes: 14 additions & 14 deletions language_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@
# Contributors:
# Broadcom, Inc. - initial API and implementation

PROJECT(language_server)
PROJECT(hlasm_language_server)

include(GoogleTest)

# compile sources to the executable
add_library(language_server_base OBJECT)
add_library(hlasm_language_server_base OBJECT)

target_include_directories(language_server_base PUBLIC src)
target_include_directories(hlasm_language_server_base PUBLIC src)

add_executable(language_server)
generate_emscripten_node_runner(language_server)
add_executable(hlasm_language_server)
generate_emscripten_node_runner(hlasm_language_server)

add_subdirectory(src)

# link executable with libraries
target_link_libraries(language_server_base nlohmann_json::nlohmann_json)
target_link_libraries(language_server_base parser_library)
target_link_libraries(language_server_base boost-asio)

target_link_libraries(language_server language_server_base)
target_link_libraries(language_server nlohmann_json::nlohmann_json)
target_link_libraries(language_server boost-asio)
target_link_libraries(language_server Threads::Threads)
target_link_libraries(language_server hlasm_utils)
target_link_libraries(hlasm_language_server_base nlohmann_json::nlohmann_json)
target_link_libraries(hlasm_language_server_base parser_library)
target_link_libraries(hlasm_language_server_base boost-asio)

target_link_libraries(hlasm_language_server hlasm_language_server_base)
target_link_libraries(hlasm_language_server nlohmann_json::nlohmann_json)
target_link_libraries(hlasm_language_server boost-asio)
target_link_libraries(hlasm_language_server Threads::Threads)
target_link_libraries(hlasm_language_server hlasm_utils)

if(BUILD_TESTING)
add_subdirectory(test)
Expand Down
8 changes: 4 additions & 4 deletions language_server/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Contributors:
# Broadcom, Inc. - initial API and implementation

target_sources(language_server_base PRIVATE
target_sources(hlasm_language_server_base PRIVATE
base_protocol_channel.cpp
base_protocol_channel.h
blocking_queue.h
Expand Down Expand Up @@ -41,12 +41,12 @@ target_sources(language_server_base PRIVATE
)

if(EMSCRIPTEN)
target_sources(language_server_base PRIVATE emscripten_server_streams.cpp)
target_sources(hlasm_language_server_base PRIVATE emscripten_server_streams.cpp)
else()
target_sources(language_server_base PRIVATE native_server_streams.cpp)
target_sources(hlasm_language_server_base PRIVATE native_server_streams.cpp)
endif()

target_sources(language_server PRIVATE
target_sources(hlasm_language_server PRIVATE
main.cpp
)

Expand Down
Loading

0 comments on commit d5b341e

Please sign in to comment.