Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: disneystreaming/vscode-smithy
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.9
Choose a base ref
...
head repository: disneystreaming/vscode-smithy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 16 commits
  • 9 files changed
  • 4 contributors

Commits on May 10, 2023

  1. Copy the full SHA
    4a67a7c View commit details
  2. all prs

    kubukoz committed May 10, 2023
    Copy the full SHA
    d064da8 View commit details
  3. deploy needs build

    kubukoz committed May 10, 2023
    Copy the full SHA
    eecac07 View commit details
  4. bump checkout

    kubukoz committed May 10, 2023
    Copy the full SHA
    4b1f256 View commit details
  5. only build on main

    kubukoz committed May 10, 2023
    Copy the full SHA
    d882466 View commit details
  6. Fix extension vsix

    kubukoz committed May 10, 2023
    Copy the full SHA
    d2846cf View commit details
  7. Merge pull request #20 from disneystreaming/fix-extension

    Fix extension vsix
    Baccata authored May 10, 2023
    Copy the full SHA
    8d9e8da View commit details

Commits on May 11, 2023

  1. Merge pull request #19 from disneystreaming/ci-run-main

    Run CI on main, run tests on non-PRs too
    daddykotex authored May 11, 2023
    Copy the full SHA
    af1e1e7 View commit details

Commits on Jun 9, 2023

  1. Copy the full SHA
    198c883 View commit details
  2. Merge pull request #22 from disneystreaming/specify-main-class

    Specify main class in launch options
    daddykotex authored Jun 9, 2023
    Copy the full SHA
    e7f4c79 View commit details

Commits on Jul 18, 2023

  1. Copy the full SHA
    08d373f View commit details
  2. Copy the full SHA
    c98399d View commit details

Commits on Jul 19, 2023

  1. Merge pull request #24 from disneystreaming/dfrancoeur/23-trait-highl…

    …ights
    
    Support fully qualified name in traits
    daddykotex authored Jul 19, 2023
    Copy the full SHA
    a74213a View commit details

Commits on Nov 27, 2023

  1. Copy the full SHA
    09a15ff View commit details

Commits on Jan 3, 2024

  1. Merge pull request #25 from disneystreaming/dfrancoeur/keep-lsplog

    LspLog is disabled by default, this activates it
    daddykotex authored Jan 3, 2024
    Copy the full SHA
    c34600f View commit details

Commits on Jun 4, 2024

  1. Update coursier version, support arm64 (#26)

    Update coursier version to  support arm64
    etspaceman authored Jun 4, 2024
    Copy the full SHA
    1880119 View commit details
Showing with 119 additions and 20 deletions.
  1. +3 −3 .github/workflows/ci.yml
  2. +11 −1 README.md
  3. +6 −0 package.json
  4. +1 −1 smithy.tmGrammar.json
  5. +5 −1 src/coursier/coursier.ts
  6. +28 −6 src/coursier/download-coursier.ts
  7. +13 −3 src/extension.ts
  8. +36 −2 tests/coursier/download-coursier.spec.ts
  9. +16 −3 yarn.lock
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
on:
push:
tags: ["v*"]
branches: ["main"]
pull_request:
branches: ["*"]

name: Build and deploy
jobs:
build:
if: github.event_name == 'pull_request'
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build & test
run: yarn ci

@@ -22,6 +21,7 @@ jobs:

deploy:
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
needs: build
name: Publish
runs-on: ubuntu-latest
steps:
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -90,4 +90,14 @@ Error in `Log(Extension Host)` channel:
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
```

This happens because the extension exchange with the language server via std in/out of the child process. If any of the code that runs in the language server prints to the standard out, VS Code will complain (unless it is specifically formatted that way).
This happens because the extension exchange with the language server via std in/out of the child process. If any of the code that runs in the language server prints to the standard out, VS Code will complain (unless it is specifically formatted that way).

Error in `Log(Remote Extension Host)` channel when downloading Coursier:

```
Failed to establish a socket connection to proxies extension
```

This happens when using the extension in a remote environment (e.g. devcontainers), and the proxy support is set to `override`. This can be resolved by setting this to `off`.

See this related [github issue](https://github.com/microsoft/vscode-pull-request-github/issues/4624#issuecomment-1845285077) for more information.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -16,6 +16,9 @@
"activationEvents": [
"onLanguage:smithy"
],
"extensionKind": [
"workspace"
],
"main": "./out/src/extension",
"contributes": {
"configuration": {
@@ -102,7 +105,10 @@
"vscode": "^1.43.0"
},
"dependencies": {
"concat-map": "^0.0.2",
"follow-redirects": "^1.14.9",
"semver": "^7.5.0",
"unzip-stream": "^0.3.4",
"vscode-languageclient": "^8.0.0"
},
"devDependencies": {
2 changes: 1 addition & 1 deletion smithy.tmGrammar.json
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@
]
},
"traits": {
"match": "@([\\w]+)\\b",
"match": "@([\\w\\.#]+)\\b",
"name": "support.function"
},
"camelcase": {
6 changes: 5 additions & 1 deletion src/coursier/coursier.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,11 @@ export function getCoursierExecutable(extensionPath: string): Promise<string> {
return downloadCoursierIfRequired(
extensionPath,
process.platform,
"v2.0.13"
process.arch,
// Have to use a commit hash for now since the launchers repository is untagged
// See https://github.com/coursier/coursier/issues/2998
"56971135cd9b08eaefed13b4d6b7a95ba9cce572",
"v2.1.10"
);
}
});
34 changes: 28 additions & 6 deletions src/coursier/download-coursier.ts
Original file line number Diff line number Diff line change
@@ -3,11 +3,15 @@ import { https } from "follow-redirects";
import { IncomingMessage } from "http";
import * as fs from "fs";
import { access, mkdir } from "fs/promises";
import * as zlib from "zlib";
import * as unzip from "unzip-stream";

export function downloadCoursierIfRequired(
extensionPath: string,
platform: string,
versionPath: string
arch: String,
versionPath: string,
versionPathArm64: String
): Promise<string> {
function binPath(filename: string) {
return path.join(extensionPath, filename);
@@ -23,20 +27,34 @@ export function downloadCoursierIfRequired(

const supportedTargets = {
darwin: {
url: `https://github.com/coursier/coursier/releases/download/${versionPath}/cs-x86_64-apple-darwin`,
url: `https://github.com/coursier/launchers/raw/${versionPath}/cs-x86_64-apple-darwin.gz`,
bin: binPath("coursier"),
},
linux: {
url: `https://github.com/coursier/coursier/releases/download/${versionPath}/cs-x86_64-pc-linux`,
url: `https://github.com/coursier/launchers/raw/${versionPath}/cs-x86_64-pc-linux.gz`,
bin: binPath("coursier"),
},
win32: {
url: `https://github.com/coursier/coursier/releases/download/${versionPath}/cs-x86_64-pc-win32.exe`,
url: `https://github.com/coursier/launchers/raw/${versionPath}/cs-x86_64-pc-win32.zip`,
bin: binPath("coursier.exe"),
},
};

const target = supportedTargets[platform];
const supportedTargetsArm64 = {
darwin: {
url: `https://github.com/VirtusLab/coursier-m1/releases/download/${versionPathArm64}/cs-aarch64-apple-darwin.gz`,
bin: binPath("coursier"),
},
linux: {
url: `https://github.com/VirtusLab/coursier-m1/releases/download/${versionPathArm64}/cs-aarch64-pc-linux.gz`,
bin: binPath("coursier"),
},
};

const target =
arch === "arm64"
? supportedTargetsArm64[platform]
: supportedTargets[platform];
if (target === undefined) {
return Promise.reject(`Unsupported platform ${platform}.`);
} else {
@@ -78,7 +96,11 @@ function downloadFile(url: string, targetFile: string): Promise<string> {
flags: "wx",
mode: 0o755,
});
response.pipe(file);
targetFile.endsWith(".exe")
? response.pipe(unzip.Parse()).on("entry", (entry) => {
entry.pipe(file);
})
: response.pipe(zlib.createUnzip()).pipe(file);

file.on("finish", () => {
console.log(`Finished downloaded file at ${targetFile}`);
16 changes: 13 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -41,6 +41,9 @@ export function activate(context: ExtensionContext) {
{ scheme: "file", language: "smithy" },
{ scheme: "smithyjar", language: "smithy" },
],
initializationOptions: {
logToFile: "enabled",
},
synchronize: {
// Notify the server about file changes to 'smithy-build.json' files contained in the workspace
fileEvents: workspace.createFileSystemWatcher("**/{smithy-build}.json"),
@@ -79,9 +82,16 @@ export function activate(context: ExtensionContext) {
const launcher = ["launch", finalLanguageServerArtifact];
// m2Local is relevant when `gradle` is used to publish locally
// coursier default resolvers are ivy2Local and maven central at the time of writing
const coursierOptions = ["--ttl", "1h", "--repository", "m2Local"].concat(
javaOptions
);
const coursierOptions = [
"--ttl",
"1h",
"--repository",
"m2Local",
// Necessary since the inclusion of Smithy CLI in the LS dependencies
"--main-class",
"software.amazon.smithy.lsp.Main",
].concat(javaOptions);

const split = ["--"];
const lspArguments = ["0"]; // port 0 means we use std in/out to exchange with the language server
const args = launcher.concat(coursierOptions, split, lspArguments);
38 changes: 36 additions & 2 deletions tests/coursier/download-coursier.spec.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,35 @@ import { join } from "path";
const dir = join(tmpdir(), p);
rmSync(dir, { recursive: true, force: true });
mkdirSync(dir, { recursive: true });
return downloadCoursierIfRequired(dir, p, "v2.0.13").then((x) => {
return downloadCoursierIfRequired(
dir,
p,
"x64",
"56971135cd9b08eaefed13b4d6b7a95ba9cce572",
"v2.1.10"
).then((x) => {
expect(existsSync(x)).toBeTruthy();
accessSync(x, constants.X_OK);
});
},
25 * 1000
);
});

["darwin", "linux"].forEach((p) => {
test(
`download on platform: ${p}`,
() => {
const dir = join(tmpdir(), p);
rmSync(dir, { recursive: true, force: true });
mkdirSync(dir, { recursive: true });
return downloadCoursierIfRequired(
dir,
p,
"arm64",
"56971135cd9b08eaefed13b4d6b7a95ba9cce572",
"v2.1.10"
).then((x) => {
expect(existsSync(x)).toBeTruthy();
accessSync(x, constants.X_OK);
});
@@ -21,6 +49,12 @@ import { join } from "path";

test(`fails on unknown platform`, () => {
return expect(
downloadCoursierIfRequired(tmpdir(), "unsupported", "v2.0.13")
downloadCoursierIfRequired(
tmpdir(),
"unsupported",
"x64",
"56971135cd9b08eaefed13b4d6b7a95ba9cce572",
"v2.1.10"
)
).rejects.toEqual("Unsupported platform unsupported.");
});
19 changes: 16 additions & 3 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.