Giter Site home page Giter Site logo

vscode-shopify-ruby's Introduction

Ruby extensions pack logo

Build Status

VS Code Shopify Ruby

This extension pack contains an opinionated collection of pre-configured extensions for Ruby development in VS Code:

Note that the Sorbet extension will only be activated if your project is onboarded to the Sorbet type checker. Also, the Ruby LSP extension includes a debugger for common debugging use-cases. You may need to use the Ruby Debugger extension for certain scenarios.

Note

This extension does not implement any Ruby related features. It's just a pack containing other extensions, which are the ones that deliver the features. If you encounter Sorbet related issues, please report them in https://github.com/sorbet/sorbet If you are using RDBG to debug and encounter issues, please report them in https://github.com/ruby/vscode-rdbg For other Ruby development issues, please report them in https://github.com/Shopify/vscode-ruby-lsp

Usage

Search for Shopify.ruby-extensions-pack in the extensions tab and click install.

When activated, this extension will prompt you about overriding your existing configuration to use the recommended defaults. You may want to backup your settings.json file before trying this extension out.

The recommended settings and their respective values can be found in the extension configuration file.

Commands

The commands offered to help manage the recommended settings are:

"Ruby extension pack: Force apply defaults" -> Apply all defaults
"Ruby extension pack: Clear cache and recommended settings" -> Clear all cached choices and remove the recommended settings

Themes

Included in this extension is the Spinel dark theme, which is made specifically for Ruby using all of the semantic highlighting information provided by the Ruby LSP.

Example code highlighted with the Spinel theme

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/vscode-shopify-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Executing tests

  1. Open VS Code on this repo
  2. Make sure dependencies are installed (yarn install)
  3. On VS Code's run and debug tab, select the Extension tests task
  4. Click the run button or press F5 to run tests. Output is displayed in the debug console

Testing the extension locally

  1. Open VS Code on this repo
  2. Make sure dependencies are installed (yarn install)
  3. On VS Code's run and debug tab, select the Extension task
  4. This will open a second VS Code window where the development version of the extension is running. Use it to verify that the extension is working as expected
  5. If needed, the cache and recommended settings can be cleared by running the Ruby extension pack: Clear cache and recommended settings command. This will make the extension prompt overrides again

Debugging

To debug the extension, add breakpoints using the VS Code interface and either run the tests or the extension in development mode.

License

The extension is available as open source under the terms of the MIT License.

vscode-shopify-ruby's People

Contributors

adisonlampert avatar andyw8 avatar danielwright avatar dependabot[bot] avatar egiurleo avatar francisbeaudoin avatar github-actions[bot] avatar gmcgibbon avatar kaanozkan avatar louim avatar morriar avatar ryanbrushett avatar schwad avatar st0012 avatar vinistock avatar wildmaples avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-shopify-ruby's Issues

how to use this extensions?

is there any requirements list for things that we should install? or setup that we should do to make the extension works?

Avoid running multiple release actions

For some reason, when we create a single release, three publish builds are enqueued.

This has no actual impact, since one of the builds successfully publishes and then the other two fail saying that the current version is already uploaded. However, it does pollute the actions log and notifies our team that an action has failed, so it would be nice to figure out how to make it enqueue only a single publish action.

Ruby extension wants to set Shopify.ruby-lsp as default formatter, but then complains it can't format Ruby

When I open a Ruby file, I get the error 'No configuration found for editor.defaultFormatter. Would you like to apply the suggested default ("Shopify.ruby-lsp")?'

image

If I click Apply, then open the command palette and run Developer: Reload Window I get the formatter error icon in the status bar. Clicking on it shows a message saying "Formatting — Extension 'Ruby-LSP' is configured as formatter but it cannot format 'Ruby'-files'. Clicking the Configure… link only offers me ruby-rubocop-revived as a formatter.

image

Why would the extension offer to set Ruby-LSP as the default formatter if it can't format Ruby? (I'm not sure if the problem is that it's offering when it shouldn't, or if VSCode thinks Ruby-LSP can't format when it can :)

The wording on the button to apply/override settings is a bit confusing

I didn't catch a screenshot but:

Problem

When you're applying our settings on an environment that doesn't have entries for said settings, the button to accept our settingss says "override" even when we're not overriding anything. We're simply adding. I'd expect the word "override" only when I'm truly overriding a decision I've already made.

Solution

If a VSCode environment doesn't have any existing entry for a setting that we're applying, let's have the button read "add all" or "accept all" to avoid any confusion on what it's actually doing.
Similar for the 'choose individual settings' workflow. Let's use "add" or "accept" in the case where there's no existing setting.

Only if a setting exists already in some capacity should we use the word "override"

Replace GitHub Personal Access Tokens with Org-Rotated Tokens

TL;DR

The use of personal access tokens (or PATs) has been detected in workflows at use in this repository.

Due to various security concerns around the use of personal access tokens in GitHub Actions, you must onboard to the new centralized token rotations service and replace all use of personal access tokens with a new, organization-provided rotated token.

Why is this being asked?

Personal access tokens in use at Shopify for GitHub Actions provide an unnecessarily large blast radius.

  • They are typically not rotated on any set schedule.
  • They are vulnerable to developer churn (i.e. a developer leaves Shopify; their personal access tokens become unauthorized for use at Shopify)
  • They incorrectly identify an actor that uses that token as the creator’s account, making it hard to audit and attribute usage correctly.

Replacing the use of personal access tokens with organization-provided tokens will provide the following benefits:

  • The responsibility of managing secrets and tokens falls to the centralized service, rather than individual teams/developers.
  • They will be automatically expired and rotated without developer overhead.
  • They are not impacted by developer churn.
  • The security auditing and logging capabilities are greatly improved for use in triaging incidents.

What will happen if it doesn't get done within the expected timeframe?

A security audit will be performed, and teams will be asked to explain why personal access tokens are in continued use.

Detailed description

More resources:

When does it need to get done?

At the latest, this should be done before 2022-08-31.

I have questions/concerns about this

Please contact the code-scale team using Slack at #code-scale.

Rename extension

The display name Ruby can be confusing and doesn't indicate that this is an extension pack and in fact includes no Ruby related features in its own code (everything comes from the extensions included in the pack).

We tried renaming it #565, but unfortunately the marketplace won't accept a display name change and publishing fails.

We need to investigate if there's a process for renaming the extension. Maybe we have to file a request somewhere.

Clarify that this extension is not intended for general Ruby development

Through the magic of ✨algorithms✨, naming, and (presumably) being a verified org, this extension is currently the top non-deprecated result for "ruby" in the VSCode extensions shop. However, per Kevin Newton it is meant specifically for Shopify Rails development, not for general Ruby dev. There's probably nothing you can do to sink the extension below Ruby-LSP in the search results, but a clear notice in the description and README that this is intended for Shopify development would be a service to newcomers and eliminate some confusion.

image

Is there a way to use this extension without it changing my rulers?

For probably 15 years I've had my editor configured with rulers at 72, 80, and 120 characters. This extension hardcodes the 120-character ruler under [ruby] editors.ruler — which would be ok, because I can edit my settings.json to remove that setting. The problem is that the extension's setting is regularly added back to my settings.json, either by the extension itself or perhaps by something like VS Code’s setting syncing.

This repeated override of my preferences is annoying, and I'd like it to stop. Is there a way I can prevent the extension from interfering?

Stand-alone theme

It would be great if we could install the theme used in the pack (Spinel) by itself.

Add setting to disable Spinel theme prompt

I'd like a method to disable the theme suggestion permanently so that I don't see if on a fresh VSCode.

With remote development environments, we are starting with a fresh VSCode state. I'm seeing the "try new Ruby code theme" prompt very often, and I'd like a way to disable it in my VSCode config.

I think there could be two approaches here:

  • Add & document a VSCode setting which can be turned on in order to disable the suggestion
  • In the suggestion, add a button to persist the "no" into my VSCode settings

image

Add in-editor test runner to extension pack

We might just be able to use the Ruby Test Runner extension.

The goal is to be able to easily run Ruby tests in VSCode by clicking a button in the editor. The extension linked above has options to run all the tests in a project, all tests in a file, or even to run just the test at a certain cursor location. This is not the same thing as the Test Explorer, which our team could investigate further in a separate ticket.

After clearing state, cannot update settings by deciding for each

  1. Open up a repository in debug mode (fn + F5)
  2. Navigate to settings.json
  3. Open up the command palette (cmd + shift + P)
  4. Search for "Ruby extensions pack: Clear cache and recommended settings" and click it
  5. Close & reopen the repository
  6. When prompted to apply recommended settings, click Decide for each
  7. Click Apply and the settings will be not be added to settings.json

This bug was likely caused by #133

Add an icon

Even if we don't have a logo yet, we should at list use the Ruby logo to make the extension stand out in the search results:

image

Enable VS Code bracket pair colorization by default

Should we enable this feature by default?

This feature might be a bit too "flashy" with default themes. See this snippet for example:

image

vs. the default behavior:

image

Is is nonetheless possible to fix the colors used. For example I used those colors and the result is more acceptable for me:

    "workbench.colorCustomizations": {
        "editorBracketHighlight.foreground1": "#cccccc",
        "editorBracketHighlight.foreground2": "#99cccc",
        "editorBracketHighlight.foreground3": "#cc99cc",
        "editorBracketHighlight.foreground4": "#cccc99",
        "editorBracketHighlight.foreground5": "#77cc99",
        "editorBracketHighlight.foreground6": "#9999cc",
    }

image

Syntax highlighting breaks on non-Spinel themes

After reading #562, I was a bit concerned about using these extensions for general development, but they appear fine to use right now. I've just noticed, though, syntax highlighting sometimes breaks in other color themes. Below is a Regexp to match a Japanese date format in the built-in Red color theme. It does not appear like this without the Ruby extensions installed. To note, the Spinel themes that comes with the extensions do not appear to have this issue.

Screenshot 2024-02-01 at 17 10 12

Message about uninstalling reborn.ruby and wingrunr21.vscode-ruby upon Vscode startup

Operating System

OSX 13.3.1

Ruby version

3.1.3

Project has a bundle

  • Has bundle

Ruby version manager being used

rvm

Description

Looking in the .ruby-lsp Gemfile.lock, I am using ruby-lsp 0.4.5 and the extension version is 0.2.5 and Vscode says it is up to date. When I start Vscode I see the following message

The Ruby LSP has fully replaced the Ruby plugin functionality. Uninstall the rebornix.rubyand thewingrunr21.vscode-rubyextensions. ClickCleanupto remove related configuration.

I have searched for the two cited extensions and can find neither. I have clicked 'Cleanup` but the error occurs again upon startup. I am new to the extension but I am finding very useful, thank you. It is just a bit talkative upon startup.

Remove ? and ! from editor.wordSeparators

Hey!

VSCode default setting for splitting selection and doing word related navigations or operations (editor.wordSeparators) is: "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?"

Since in ruby ? and ! are often used as method suffixes, what do you think of adding a ruby specific setting removing ? and ! from the default editor.wordSeparators? This would allow easier selection (think double-click and arrow selection) of method and symbols ending with those 2 chars.

Why does it bundle koichisasada.vscode-rdbg when Shopify.ruby-lsp supports debugging?

This is really unclear. Shopify.ruby-lsp supports debugging. And this extension pack depends on koichisasada.vscode-rdbg. So what should I use to debug? Shopify.ruby-lsp or koichisasada.vscode-rdbg? If the answer is Shopify.ruby-lsp, then this plugin should no longer bundle koichisasada.vscode-rdbg. And if the answer is koichisasada.vscode-rdbg, then why does Shopify.ruby-lsp support debugging?

Interest in supporting this extension pack in a GitHub Codespace?

My team has been using Codespaces more and more for Ruby development (Rails w/ Postresql mostly), and I've been looking for best practices to follow. I'm not sure it's entirely in scope for this repo, but would love to know if anyone is using this successfully with GitHub Codespaces for their team?

If so, would you be willing to share your setup in this repo, so you can quickly configure a new Codespace using this extension pack? Would the maintainers be interested in that kind of contribution?

How can I add the semantic token colours to an existing theme that doesn't have them?

I find the Spinel theme to be much too bright (and very distracting as a result) so I'm using Darcula IntelliJ Theme Extended instead. It doesn't have the semantic token colours needed for Ruby, though.

I've tried adding this to settings.json but it doesn't seem to make any difference to what's displayed when I open a Ruby file — I still the the same as if I hadn't added this JSON.

  "editor.semanticTokenColorCustomizations": {
    "[Darcula IntelliJ Theme Extended]": {
      "enabled": true,
      "rules": {
        "variable": "#1eda7c",
        "class": {
          "foreground": "#ec7a08",
          "fontStyle": "bold"
        }
      }
    }
  },

(Yes, those two colours are also garish, but I wanted to be sure I could see them change while I was experimenting :)

Am I actually configuring this correctly?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.