Support Prism 2

Ouverte
#4,277 0 commentaires 2 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
35/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
ruby

Piste de recherche

Start by checking the gemspec Prism constraint and the 28 failing tests reported with Prism 2.1.0; compare their results with Prism 1.9.0. Investigate the listed differences in syntax tree nodes, multibyte locations, and typed-file feature checks. Done means Prism 2 can be allowed alongside Prism 1 and the affected tests pass; the development bundle's rbi constraint is identified as a separate blocker.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

I have checked that this feature is not already implemented
  • This feature does not exist
Use case

The gemspec has prism >= 1.2, < 2.0, so a bundle with Ruby LSP in it can't move to Prism 2.

That gets in the way for RuboCop. rubocop-ast 1.52 has a parser engine that builds RuboCop's AST straight from the Prism result, without Prism::Translation::Parser, and it needs Prism 2. Most projects that use RuboCop have Ruby LSP in the same bundle, so in practice they can't use it, and RuboCop's own Gemfile has to leave Ruby LSP out to test it.

Description

Allow Prism 2 next to Prism 1, i.e. prism >= 1.2, < 3.0.

Implementation

I tried it on main (ad2996a) with Prism 2.1.0, without Tapioca and Sorbet in the bundle. Of the 18,625 tests, 28 fail that pass with Prism 1.9.0. The ones I looked at:

  • Prism::MissingNode is Prism::ErrorRecoveryNode now (CodeActionResolve, and the expected output of the show syntax tree test)
  • the lengths and columns for multibyte characters are off in semantic highlighting, and RubyDocument#locate ends up with a ProgramNode where it expects a named node
  • the typed: true and typed: strict checks no longer disable completion, hover, definition and signature help

The development bundle is a separate problem: rbi needs prism ~> 1.0, and the PR that relaxes it (Shopify/rbi#681) fails its tests.

I can send a PR for the Ruby LSP side if that helps.

Langage dominant
Ruby
Étoiles
2k
Forks
300
Merge moyen
2 h 54 min
PR mergées (30 j)
9

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de Shopify/ruby-lsp

Toutes les issues de Shopify/ruby-lsp

Issues similaires

Plus d'issues Ruby

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.