Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

218 - Windows platform support #219

Merged
merged 11 commits into from
Dec 6, 2023
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile
- run: yarn install --immutable
if: steps.yarn-cache.outputs.cache-hit != 'true'

- run: yarn workspace ${{ matrix.workspace.name }} run lint
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile
- run: yarn install --immutable
if: steps.yarn-cache.outputs.cache-hit != 'true'

- run: yarn workspace ${{ matrix.workspace.name }} run format
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/execute-yarn-workspace-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
${{ runner.os }}-yarn-

- name: Install dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
if: steps.yarn-cache.outputs.cache-hit != 'true'

- name: Run command (with target)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-extension-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:

- name: Install
run: |
yarn install --frozen-lockfile
yarn install --immutable

- name: Get tag prefix
id: get-tag-prefix
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-targeted-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
${{ runner.os }}-yarn-

- name: Install dependencies
run: yarn install --frozen-lockfile
run: yarn install --immutable
if: steps.yarn-cache.outputs.cache-hit != 'true'

- name: Build
Expand Down
659 changes: 292 additions & 367 deletions .pnp.cjs

Large diffs are not rendered by default.

89 changes: 63 additions & 26 deletions .pnp.loader.mjs

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

1 change: 1 addition & 0 deletions remove-me-41a7fb1159c54b71872b.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
41a7fb1159c54b71872b
2 changes: 1 addition & 1 deletion toolchains/solidity/core/scripts/copy-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fs.readdir('target', { withFileTypes: true }, (err, dirs) => {
return;
}
const files = entries.filter(file => file.isFile()).map(file => file.name);
const serverBinaries = files.filter(file => file.endsWith('-server'));
const serverBinaries = files.filter(file => file.endsWith('-server') || file.endsWith('-server.exe'));
serverBinaries.forEach(binary => {
fs.copyFile(`target/${dir}/${binary}`, `${outputFolder}/${binary}`, (err) => {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion toolchains/solidity/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "osmium-solidity-extension",
"displayName": "Osmium Solidity",
"description": "",
"version": "0.2.1",
"version": "0.1.3",
"publisher": "OsmiumToolchains",
"repository": {
"type": "git",
Expand Down
60 changes: 9 additions & 51 deletions toolchains/solidity/extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* ------------------------------------------------------------------------------------------ */

import * as path from 'path';
import { workspace, ExtensionContext, Uri } from 'vscode';
import { workspace, ExtensionContext } from 'vscode';
import { TextDecoder } from 'util';

import {
Expand All @@ -13,53 +13,18 @@ import {
ServerOptions,
TransportKind
} from 'vscode-languageclient/node';
import { createLinterClient } from './linter';

let client: LanguageClient;

export async function activate(context: ExtensionContext) {
// The server is implemented in node
const serverBinary = context.asAbsolutePath(
path.join('dist', 'linter-server')
);

// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
const serverOptions: ServerOptions = {
run: { command: serverBinary, transport: TransportKind.stdio },
debug: {
command: serverBinary,
transport: TransportKind.stdio,
}
};

// Options to control the language client
const clientOptions: LanguageClientOptions = {
// Register the server for plain text documents
documentSelector: [{ scheme: 'file', language: 'solidity' }],
synchronize: {
// Notify the server about file changes to '.clientrc files contained in the workspace
fileEvents: workspace.createFileSystemWatcher('**/.solidhunter.json')
}
};

// Create the language client and start the client.
client = new LanguageClient(
'osmium-solidity',
'Osmium Solidity Language Server',
serverOptions,
clientOptions
);
let linterClient: LanguageClient;

client.onRequest('osmium/getContent', async (params) => {
const contentUint8 = await workspace.fs.readFile(Uri.parse(params.uri));
const content = new TextDecoder().decode(contentUint8);
return {
content,
};
});
export async function activate(context: ExtensionContext) {
linterClient = createLinterClient(context);

// Start the client. This will also launch the server
client.start();
// Push the disposable to the context's subscriptions so that the
// client can be deactivated on extension deactivation
context.subscriptions.push(linterClient);


const folders = workspace.workspaceFolders;
if (folders) {
Expand All @@ -70,10 +35,3 @@ export async function activate(context: ExtensionContext) {
}

}

export function deactivate(): Thenable<void> | undefined {
if (!client) {
return undefined;
}
return client.stop();
}
61 changes: 61 additions & 0 deletions toolchains/solidity/extension/src/linter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import * as path from 'path';
import * as os from 'os';
import { workspace, ExtensionContext, Uri } from "vscode";
import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
TransportKind
} from 'vscode-languageclient/node';
import { TextDecoder } from 'util';

export function createLinterClient(context: ExtensionContext): LanguageClient {
// The server is implemented in node
const serverBinary = context.asAbsolutePath(
path.join(
'dist',
os.platform().startsWith("win") ? 'linter-server.exe' : 'linter-server'
)
);

// If the extension is launched in debug mode then the debug server options are used
// Otherwise the run options are used
const serverOptions: ServerOptions = {
run: { command: serverBinary, transport: TransportKind.stdio },
debug: {
command: serverBinary,
transport: TransportKind.stdio,
}
};

// Options to control the language client
const clientOptions: LanguageClientOptions = {
// Register the server for plain text documents
documentSelector: [{ scheme: 'file', language: 'solidity' }],
synchronize: {
// Notify the server about file changes to '.clientrc files contained in the workspace
fileEvents: workspace.createFileSystemWatcher('**/.solidhunter.json')
}
};

// Create the language client and start the client.
const client = new LanguageClient(
'osmium-solidity-linter',
'Osmium Solidity Linter Language Server',
serverOptions,
clientOptions
);

client.onRequest('osmium/getContent', async (params: { uri: string}) => {
const contentUint8 = await workspace.fs.readFile(Uri.parse(params.uri));
const content = new TextDecoder().decode(contentUint8);
return {
content,
};
});

// Start the client. This will also launch the server
client.start();

return client;
}
Loading
Loading