Skip to content

[question] - Issue with language server #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matoni109 opened this issue Apr 1, 2022 · 3 comments
Closed

[question] - Issue with language server #1

matoni109 opened this issue Apr 1, 2022 · 3 comments

Comments

@matoni109
Copy link

matoni109 commented Apr 1, 2022

Hi Syntax Tree,

Heard about you on Remote Ruby, getting below after I installed the gem.

Ruby 2.5.0

Ruby Version: 2.5.0
VS Code: Version: 1.66.0 (Universal)

Starting language server...
No bundled syntax_tree, running global stree.
/Users/chriswade/.asdf/installs/ruby/2.5.0/lib/ruby/gems/2.5.0/gems/syntax_tree-2.0.1/lib/syntax_tree.rb:8:in `require_relative': /Users/chriswade/.asdf/installs/ruby/2.5.0/lib/ruby/gems/2.5.0/gems/syntax_tree-2.0.1/lib/syntax_tree/formatter.rb:12: syntax error, unexpected ... (SyntaxError)
    def initialize(source, ...)
                           ^~~

Ruby 2.7.4

Starting language server...
No bundled syntax_tree, running global stree.
/Users/chriswade/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/syntax_tree-2.0.1/lib/syntax_tree/language_server.rb:28: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
/Users/chriswade/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/syntax_tree-2.0.1/lib/syntax_tree/language_server/inlay_hints.rb:69: warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!
Requesting implicits
Requesting implicits
/Users/chriswade/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/syntax_tree-2.0.1/lib/syntax_tree/language_server.rb:54:in `run': Unhandled: {:jsonrpc=>"2.0", :id=>1, :method=>"syntaxTree/implicits", :params=>{:textDocument=>{:uri=>"file:///Users/chriswade/Exercism/ruby/sieve/sieve.rb"}}} (RuntimeError)
	from /Users/chriswade/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/syntax_tree-2.0.1/lib/syntax_tree/cli.rb:187:in `run'
	from /Users/chriswade/.asdf/installs/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/syntax_tree-2.0.1/exe/stree:9:in `<top (required)>'
	from /Users/chriswade/.asdf/installs/ruby/2.7.4/bin/stree:25:in `load'
	from /Users/chriswade/.asdf/installs/ruby/2.7.4/bin/stree:25:in `<main>'
[Info  - 9:43:20 am] Connection to server got closed. Server will restart.

Ruby 3.0.0

Starting language server...
No bundled syntax_tree, running global stree.
Requesting implicits
/Users/chriswade/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/syntax_tree-2.0.1/lib/syntax_tree/language_server.rb:54:in `run': Unhandled: {:jsonrpc=>"2.0", :id=>1, :method=>"syntaxTree/implicits", :params=>{:textDocument=>{:uri=>"file:///Users/chriswade/code/oe-qikpac-monitor/app/models/account_record.rb"}}} (RuntimeError)
	from /Users/chriswade/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/syntax_tree-2.0.1/lib/syntax_tree/cli.rb:187:in `run'
	from /Users/chriswade/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/syntax_tree-2.0.1/exe/stree:9:in `<top (required)>'
	from /Users/chriswade/.asdf/installs/ruby/3.0.0/bin/stree:23:in `load'
	from /Users/chriswade/.asdf/installs/ruby/3.0.0/bin/stree:23:in `<main>'
[Info  - 9:51:50 am] Connection to server got closed. Server will restart.

Thanks for putting this out :)

Regards,
Chris

@kddnewton
Copy link
Member

Ahh sorry I updated the gem and forgot to update the vscode plugin. v0.2.1 of the plugin is out now and should have the fixes.

@matoni109
Copy link
Author

matoni109 commented Apr 5, 2022

Thanks for that @kddnewton,

Still no go for repo's with Ruby 2.5.0 as version. ( image below ), other 2 are working

Also does it need any setup like below that I was using for rubocop ?

I don't seem to get any of the light blue squiggly lines suggesting things like I was with rubocop

Should I change ruby.format & ruby.intellisense to syntax.tree ( i'm guessing this )

{
  "editor.formatOnSave": true,
  "editor.formatOnType": true,
  //ruby start
  "[ruby]": {
    "editor.defaultFormatter": "misogi.ruby-rubocop"
  },
  "ruby.useLanguageServer": true, // use the internal language server (see below)
  "ruby.format": "rubocop", // use rubocop for formatting
  "ruby.intellisense": "rubyLocate",
  "ruby.useBundler": true,
  "ruby.lint": {
    "rubocop": {
      "useBundler": true
    }
  },
  "ruby.rubocop.suppressRubocopWarnings": false,
  "ruby.rubocop.onSave": true,
  "files.associations": {
    "*.erb": "erb"
  },
  "editor.codeActionsOnSave": {
    // For ESLint
    "source.fixAll.eslint": true,
    // For TSLint
    "source.fixAll.tslint": true,
    // For Stylelint
    "source.fixAll.stylelint": true
  },
  // RUBY END

 
}

Screen Shot 2022-04-05 at 10 30 33 am

@kddnewton
Copy link
Member

Okay, a couple of things. Totally not your fault, the docs are definitely lacking.

  • First of all, this requires Ruby >= 2.7.3. So your EOL rubys aren't going to work. Sorry about that.
  • You don't need any setup, except you can set "ruby.format" to false. That configuration option is provided a different extension, so you should turn off its formatting so that syntax tree can take over.
  • There's no ruby.intellisense option for this plugin, since it's just for formatting.
  • So you don't get diagnostics with this extension. The function of this extension is just to format, not to lint.

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

No branches or pull requests

2 participants