Skip to content

Conversation

ono-max
Copy link

@ono-max ono-max commented Sep 22, 2025

Source code change summary

  • The following files were extracted from ruby-lsp without any modifications
    • src/ruby/**
    • src/workspaceChannel.ts
  • src/ruby.ts was extracted from ruby-lsp, and modified to adapt to the API.

Extension Settings

{
    "extensionDependencies": [
        "shopify.ruby-environments"
    ],
    "dependencies": {
        "@shopify/ruby-environments": "..."
    },
}

API

API Specification: https://github.com/Shopify/ruby-environments/blob/6254b3c216921a28737ebbe748238f4ba89b6782/rubyEnvironmentsApi/src/index.ts

Here is the example:

// Import the API
import { RubyEnvironments } from '@shopify/ruby-environments';

const rubyEnvApi: RubyEnvironmentsApi = await RubyEnvironmentsApi.getApi();

const rubyEnv = await rubyEnvApi.getEnvironment(vscode.workspace.workspaceFolders[0]);

This API is inspired by the following projects:

How to test this code

  1. Install both VS Code extension and NPM module as follows:
  1. Modify package.json in your testing VS Code extension as follows:
{
    "extensionDependencies": [
        "shopify.ruby-environments"
    ],
    "dependencies": {
        "@shopify/ruby-environments": "..."
    },
}
  1. Add the following lines to your testing VS Code extension.
import { RubyEnvironments } from '@shopify/ruby-environments';
const rubyEnvApi: RubyEnvironmentsApi = await RubyEnvironmentsApi.getApi();
const rubyEnv = await rubyEnvApi.getEnvironment(vscode.workspace.workspaceFolders[0]!);
console.log(rubyEnv);

@ono-max
Copy link
Author

ono-max commented Sep 22, 2025

I have signed the CLA!

@ono-max ono-max force-pushed the extract-code-from-ruby-lsp branch 18 times, most recently from c0d4a74 to f2f1f48 Compare September 23, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant