Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client update to connect to ViperServer's language server #113

Merged
merged 86 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
4857a78
Connected ViperServer to Viper IDE
Sep 18, 2020
d3f2d58
verification running, diagnostics showing
Oct 11, 2020
896486a
main verification cycle error-free
Oct 12, 2020
6e602b0
added cache flushing and proper termination
Oct 13, 2020
13f2b6d
implemented Carbon/Silicon swap
Oct 13, 2020
30b9c38
Made backend swap work
Oct 14, 2020
bb5f859
start ViperServer on cp to LSP frontent
Oct 19, 2020
684ae26
removed files from git, cleaned up code
Oct 22, 2020
9d4ebd1
cleaned settings
Oct 22, 2020
ee44e53
Further cleaning, updated copyright header.
Oct 23, 2020
2d61e33
removed 'server' codebase
Oct 23, 2020
cfd2646
removes remaining files in server/
ArquintL Jul 5, 2022
140237c
improves LSP integration and calculates number of warnings and errors…
ArquintL Aug 26, 2022
631a270
saves on-going work
ArquintL Aug 30, 2022
9e1379d
cleanup
ArquintL Aug 30, 2022
f0d77e0
correctly handles settings changes and ViperTools updates
ArquintL Aug 30, 2022
3ee9581
integrates Settings checks
ArquintL Sep 1, 2022
6eeda88
resolves conflicts
ArquintL Sep 1, 2022
1f62bc6
reenables macos
ArquintL Sep 1, 2022
9aebd52
fixes CI
ArquintL Sep 1, 2022
98b15d1
extends CI to release release candidates as pre-releases to the VSCod…
ArquintL Sep 20, 2022
b570cd5
attempts to fix CI
ArquintL Sep 20, 2022
7f69a55
yet another attempt
ArquintL Sep 20, 2022
7fd1e14
restricts CI to a single test suite
ArquintL Sep 20, 2022
f218ae0
improves & adds log output
ArquintL Sep 20, 2022
62162f2
wraps exported API with more logging
ArquintL Sep 20, 2022
98d764a
fixes wrapper for exported extension functions
ArquintL Sep 20, 2022
c684a6e
updates dependencies
ArquintL Sep 20, 2022
42cd58b
stores ViperServer log file at same location as log file from client
ArquintL Sep 20, 2022
30bb79a
reduces unit test further
ArquintL Sep 20, 2022
8d820bd
enables more log output
ArquintL Sep 20, 2022
9a5d74e
escapes path to ViperServer logfile, adds option to trace LSP communi…
ArquintL Sep 20, 2022
eac3092
redirects LSP trace to log file during unit tests
ArquintL Sep 20, 2022
83417dc
delays connection to server
ArquintL Sep 20, 2022
968750a
removes nightly test configuration and adds LSP trace logging to vsco…
ArquintL Sep 21, 2022
b1bfab4
re-adding nightly config since there is an almost up-to-date Viper-ID…
ArquintL Sep 21, 2022
669b659
enables mode for ViperServer
ArquintL Sep 21, 2022
9a78764
adapts CI to download ViperServer JAR from polybox
ArquintL Sep 22, 2022
748d5bd
fixes CI adaptations
ArquintL Sep 22, 2022
85345e1
follows redirects for downloading ViperTools and ViperServer
ArquintL Sep 22, 2022
909f336
generalizes CI
ArquintL Sep 22, 2022
78efed6
ensures that directory for setting configs indeed exists
ArquintL Sep 22, 2022
0f4cbd9
removes artificial wait
ArquintL Sep 22, 2022
02cb758
fixes log level for ViperServer
ArquintL Sep 22, 2022
bb2d116
uses SIGTERM instead of SIGINT to terminate the server process
ArquintL Sep 22, 2022
079ca0d
reduces test timeout
ArquintL Sep 22, 2022
8302465
reenables all test suites
ArquintL Sep 22, 2022
94129f3
sets loglevel to none for unit tests
ArquintL Sep 22, 2022
cc0eb3f
closes editor before every test suite
ArquintL Sep 22, 2022
6fd1801
closes open editors after starting the extension
ArquintL Sep 22, 2022
e422b84
close file before opening next one
ArquintL Sep 22, 2022
73aadcb
closes all open files before each test suite
ArquintL Sep 22, 2022
b604323
changes test suite startup to only await backend start
ArquintL Sep 22, 2022
b6b4857
explicitly verify file after tools update
ArquintL Sep 22, 2022
f6b1a20
adds more log output
ArquintL Sep 22, 2022
9fd202a
removes FileOpened event handling
ArquintL Sep 22, 2022
e761bfd
simplifies LSP communication
ArquintL Sep 26, 2022
c32238e
adapts unit tests to changes and improves stopping of verifications
ArquintL Sep 26, 2022
397b393
improves task handling in verification controller
ArquintL Sep 28, 2022
77a9644
removes unused code and updates dependencies
ArquintL Sep 28, 2022
2f4ba78
fixes CI
ArquintL Sep 28, 2022
b99eea3
adds missing file
ArquintL Sep 29, 2022
884f337
updates to latest LSP client, adapts LSP messages to be compliant (i.…
ArquintL Sep 30, 2022
319d5d0
enable logging of ViperServer
ArquintL Sep 30, 2022
f6b440f
removes additional ViperServer logging
ArquintL Sep 30, 2022
7727088
extends & fixes linting
ArquintL Sep 30, 2022
4502e77
adds test configuration to test against nightly builds
ArquintL Sep 30, 2022
31b94ce
fixes tests with multiple setting files
ArquintL Sep 30, 2022
d3f80e5
some improvements
ArquintL Sep 30, 2022
7551a78
improves Viper-IDE if server could not be started
ArquintL Sep 30, 2022
55cb174
fixes CI for pre-releases, adds mechanism to detect pre-releases to t…
ArquintL Oct 1, 2022
ce0ce3a
since the extension registers handlers early on, we ignore tasks that…
ArquintL Oct 1, 2022
7ae3023
another attempt to make unit tests more stable
ArquintL Oct 1, 2022
7013780
another attept to make unit tests more stable
ArquintL Oct 2, 2022
6b544f6
fixes a timeout during a unit test
ArquintL Oct 3, 2022
e88f008
temporarily disables testing against the nightly ViperServer build
ArquintL Oct 3, 2022
092dbb8
increases timeout
ArquintL Oct 3, 2022
50881f9
improves .gitignore files
ArquintL Oct 3, 2022
915b91f
Reverts "temporarily disables testing against the nightly ViperServer…
ArquintL Oct 3, 2022
fdb323d
cleanup
ArquintL Oct 3, 2022
03f03a6
stops CI from testing against a local ViperServer version
ArquintL Oct 3, 2022
7c5c00e
fixes flags in CI
ArquintL Oct 3, 2022
8e2ed11
test
ArquintL Oct 3, 2022
a35492e
another attempt to fix boolean expressions in CI
ArquintL Oct 3, 2022
bca78bb
yet another attempt
ArquintL Oct 3, 2022
f2cd2f8
disables CI test against local ViperServer version (now for real)
ArquintL Oct 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 62 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ on:
# note that release-candidate builds are treated like 'stable' builds for now except that there is no deployment to the marketplaces in the end.
# in the future, this should be changed such that release-candidates result in a prerelease (like nightly builds).

# the following env variables configure the behavior of this workflow
# in particular, they control whether Viper-IDE is tested against certain ViperTools and a ViperServer JAR on push and pull requests
# this is particularly useful during debugging / testing as a new Viper-IDE release is not necessary for every change to the ViperServer JAR
env:
TEST_LOCAL_ON_PUSH_PR: false
# note that the following URL is extended with `/${{ matrix.viper-tools-zip-file }}` in the 'build-and-test' job:
TEST_LOCAL_ON_PUSH_PR_VIPERTOOLS_URL: https://github.com/viperproject/viper-ide/releases/download/v-2022-09-21-1611
# the following URL is not extended and downloading the destination is expected to return the viperserver.jar:
TEST_LOCAL_ON_PUSH_PR_VIPERSERVER_URL: https://polybox.ethz.ch/index.php/s/54sDcqHDJHelKBY/download

jobs:
create-viper-tools:
if: github.event_name == 'workflow_dispatch'
Expand Down Expand Up @@ -143,10 +153,10 @@ jobs:
# tests should not be stopped when they fail on one of the OSes:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest] # [macos-latest, ubuntu-latest, windows-latest]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
# - os: macos-latest
# viper-tools-zip-file: "ViperToolsMac.zip"
- os: macos-latest
viper-tools-zip-file: "ViperToolsMac.zip"
- os: ubuntu-latest
viper-tools-zip-file: "ViperToolsLinux.zip"
- os: windows-latest
Expand Down Expand Up @@ -182,9 +192,6 @@ jobs:
git config --global url."https://github.com/".insteadOf
ssh://git@github.com/

- run: npm ci --cache ../client/.npm --prefer-offline # server uses same cache as the client
working-directory: server

- run: npm ci --cache .npm --prefer-offline
working-directory: client

Expand All @@ -193,40 +200,55 @@ jobs:
# nightly ViperTool releases. Any change to the Viper-IDE have ensure compatability
# - before releasing Viper-IDE together with some ViperTools, Viper-IDE has to be tested against the latest stable and
# nightly ViperTool releases AND the ViperTools that should be released.
- name: Download ViperTools to test against
- name: Download ViperTools to test against (only downloading previously created ViperTools)
if: ${{ contains(needs.create-viper-tools.result, 'success') }}
uses: actions/download-artifact@v2
with:
name: ViperTools
path: client/ViperTools

- name: Setup ViperTools folder
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) && !contains(needs.create-viper-tools.result, 'success') }}
run: mkdir -p client/ViperTools

- name: Download ViperTools to test against (only downloading ViperTools for PUSH and PR operations if configured accordingly)
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) && !contains(needs.create-viper-tools.result, 'success') }}
run: curl --fail --silent --show-error -L ${{ env.TEST_LOCAL_ON_PUSH_PR_VIPERTOOLS_URL }}/${{ matrix.viper-tools-zip-file }} --output ${{ matrix.viper-tools-zip-file }}
working-directory: client/ViperTools

- name: Unzip ViperTools (non-windows)
if: ${{ !startsWith(matrix.os, 'windows') && contains(needs.create-viper-tools.result, 'success') }}
if: ${{ !startsWith(matrix.os, 'windows') && (fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success')) }}
run: unzip ${{ matrix.viper-tools-zip-file }} -d ExtractedTools
working-directory: client/ViperTools

- name: Unzip ViperTools (windows)
if: ${{ startsWith(matrix.os, 'windows') && contains(needs.create-viper-tools.result, 'success') }}
if: ${{ startsWith(matrix.os, 'windows') && (fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success')) }}
run: powershell Expand-Archive -LiteralPath ${{ matrix.viper-tools-zip-file }} -DestinationPath ExtractedTools
working-directory: client/ViperTools

- name: Download ViperServer JAR (only downloading ViperTools for PUSH and PR operations if configured accordingly)
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) && !contains(needs.create-viper-tools.result, 'success') }}
run: curl --fail --silent --show-error -L ${{ env.TEST_LOCAL_ON_PUSH_PR_VIPERSERVER_URL }} --output viperserver.jar
working-directory: client/ViperTools/ExtractedTools/backends

- name: Create path to extracted tools (non-windows)
if: ${{ !startsWith(matrix.os, 'windows') && contains(needs.create-viper-tools.result, 'success') }}
if: ${{ !startsWith(matrix.os, 'windows') && (fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success')) }}
run: |
echo "EXTRACTED_TOOLS_PATH=${{ github.workspace }}/client/ViperTools/ExtractedTools" >> $GITHUB_ENV
shell: bash

- name: Create path to extracted tools (windows)
if: ${{ startsWith(matrix.os, 'windows') && contains(needs.create-viper-tools.result, 'success') }}
if: ${{ startsWith(matrix.os, 'windows') && (fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success')) }}
# replace all backslashes by double backslashes to properly escape them in the resulting JSON
run: |
PATH='EXTRACTED_TOOLS_PATH=${{ github.workspace }}\client\ViperTools\ExtractedTools'
echo ${PATH//'\'/'\\'} >> $GITHUB_ENV
shell: bash

- name: Create an additional test config
if: ${{ contains(needs.create-viper-tools.result, 'success') }}
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success') }}
run: |
mkdir -p client/src/test/data/settings
echo '{
"viperSettings.buildVersion": "Local",
"viperSettings.paths": {
Expand All @@ -236,12 +258,13 @@ jobs:
"linux": "${{ env.EXTRACTED_TOOLS_PATH }}",
"mac": "${{ env.EXTRACTED_TOOLS_PATH }}"
}
}
},
"viperserver.trace.server": "verbose"
}' > client/src/test/data/settings/ci_local.json
shell: bash

- name: Get config content
if: ${{ contains(needs.create-viper-tools.result, 'success') }}
if: ${{ fromJSON(env.TEST_LOCAL_ON_PUSH_PR) || contains(needs.create-viper-tools.result, 'success') }}
run: cat client/src/test/data/settings/ci_local.json
shell: bash

Expand Down Expand Up @@ -281,10 +304,19 @@ jobs:
run: npx vsce ls
working-directory: client

- name: Package Viper-IDE extension (ubuntu only)
if: startsWith(matrix.os, 'ubuntu')
# note that baseContentUrl has to be manually provided as vsce does not know that it is run in the client subfolder:
run: npm run package -- --baseContentUrl https://github.com/viperproject/viper-ide/raw/master/client --out viper-ide.vsix
# use vsce to package the extension into a vsix file.
# sets a special field in package.json to indicate that the package is not a pre-release (it's one
# by default)
- name: Package Viper-IDE extension (ubuntu & stable release only)
if: ${{ startsWith(matrix.os, 'ubuntu') && github.event.inputs.type == 'stable' }}
run: |
npm pkg set viper.prerelease=false --json
npm run package -- --out viper-ide.vsix
working-directory: client

- name: Package Viper-IDE extension (ubuntu & non-stable release only)
if: ${{ startsWith(matrix.os, 'ubuntu') && github.event.inputs.type != 'stable' }}
run: npm run package -- --out viper-ide.vsix --pre-release
working-directory: client

- name: Upload packaged Viper-IDE (ubuntu-only)
Expand Down Expand Up @@ -449,7 +481,7 @@ jobs:
echo "LAST_PUBLISHED_VERSION=$LAST_PUBLISHED_VERSION" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV

# only publish 'stable' releases not release-candidates
# publish 'stable' releases (release-candidates will be released as pre-releases below)
- name: Publish the extension to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v0
if: ${{ github.event.inputs.type == 'stable' && env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }}
Expand All @@ -467,3 +499,14 @@ jobs:
registryUrl: https://open-vsx.org
extensionFile: client/viper-ide.vsix
packagePath: ''

# publish 'rc' releases as pre-releases
- name: Publish the extension to Visual Studio Marketplace (as pre-release)
uses: HaaLeo/publish-vscode-extension@v0
if: ${{ github.event.inputs.type == 'rc' && env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION }}
with:
pat: ${{ secrets.VSCE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: client/viper-ide.vsix
packagePath: ''
preRelease: true
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/node_modules/
^.*\.log$
re:(?x) (^|.*\/) (?!webpack\.config) ([^\/]+)\.js $
/out/
/.vscode-test/

syntax:glob
.DS_Store
7 changes: 0 additions & 7 deletions .hgignore
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
/node_modules/
^.*\.log$
re:(?x) (^|.*\/) (?!webpack\.config) ([^\/]+)\.js $
/out/
/.vscode-test/

syntax:glob
.DS_Store
27 changes: 25 additions & 2 deletions client/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"ignorePatterns": ["webpack.config.js"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-require-imports": [ // disallow `require`
"error"
]
],
"@typescript-eslint/explicit-function-return-type": [ // require a return type for functions
"error", { "allowExpressions": true }
],
"@typescript-eslint/no-misused-promises": [ // disallow promises in place where they are unexpected and thus not handled
"error"
],
"@typescript-eslint/no-floating-promises": [ // enforce that promises get handled
"error"
],
"@typescript-eslint/no-empty-function": [
"warn", { "allow": ["arrowFunctions"] }
],
"@typescript-eslint/no-inferrable-types": [
"error", { "ignoreParameters": true, "ignoreProperties": true }
],
"no-inner-declarations": "off"
}
}
6 changes: 4 additions & 2 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.DS_Store
dist/
server/
node_modules/
out/
.vscode-test/
npm-debug.log
languageServerExample.log
logger.log
viperserver.log
12 changes: 5 additions & 7 deletions client/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
"--extensionDevelopmentPath=${workspaceRoot}" /*,
"--profile-temp",
"--disable-extensions",
"${workspaceRoot}/src/test/data" */
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/dist/**/*.js"],
"preLaunchTask": {
Expand All @@ -18,18 +20,14 @@
}
},
{
"name": "Test (Startup)",
"name": "Test",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/dist/test"
],
"env": {
"VIPER_IDE_TEST_SUITE": "${workspaceRoot}/dist/test/startup.test.js"
},
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/dist/test/**/*.js"],
"preLaunchTask": {
Expand Down
8 changes: 3 additions & 5 deletions client/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
".vscode-test": true
},

//workplace settings
"typescript.implementationsCodeLens.enabled": true,
"typescript.tsc.autoDetect": "off"

//"files.trimTrailingWhitespace": true,
//"editor.rulers": [80, 100],
//"typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
"typescript.tsc.autoDetect": "off",
"window.title": "${dirty}${activeEditorShort}${separator}$Viper IDE$"
}
Loading