tmk3s / d-eins-erp

0 stars 0 forks source link

rbs #3

Open tmk3s opened 6 months ago

tmk3s commented 6 months ago

https://github.com/pocke/rbs_rails https://github.com/ksss/orthoses https://rubygems.org/gems/orthoses-rails https://github.com/soutaro/steep

gem

group :development do
  # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
  # gem "spring"
  gem 'rbs_rails', require: false
  gem 'orthoses', require: false
  gem 'orthoses-rails', require: false
  gem 'steep', require: false
end

docker-compose exec app bundle exec rails g rbs_rails:install

↓ create lib/tasks/rbs.rake

docker-compose exec app bundle exec rbs collection init

↓ created: rbs_collection.yaml

docker-compose exec app bundle exec rbs collection install

↓ .gem_rbs_collection =>作成される

↓ gitognoreに/.gem_rbs_collectionを追加

docker-compose exec app bundle exec steep init

↓ Steepfileが作成される

https://github.com/soutaro/steep-vscode

使ってみたい vscodeで使うのでローカルでsteepコマンド使えるようにする

workspace で gem install steepする bundler: failed to load command: ruby-lsp vscode起動時にが出るので https://github.com/Shopify/ruby-lsp

gem install ruby-lsp

する

https://qiita.com/vzvu3k6k/items/12aff810ea93c7c6f307

肩チェックが目的えでゃないのでTypeProfのみ入れる

↓ [Info - 3:46:20] TypeProf for IDE is started successfully [Info - 3:46:20] bundler: failed to load command: typeprof (/Users/xxx/.rbenv/versions/3.2.1/bin/typeprof) [Info - 3:46:20] Connection to server got closed. Server will restart. [Info - 3:46:20] /Users/xxx/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/typeprof-0.21.3/lib/typeprof/import.rb:9:in `initialize': NoMethodError

[Info  - 3:59:32] TypeProf for IDE is started successfully
[Error - 3:59:32] Connection to server got closed. Server will not be restarted.
[Info  - 3:59:32] bundler: failed to load command: typeprof (/Users/xxx/.rbenv/versions/3.2.1/bin/typeprof)
[Info  - 3:59:32] /Users/xxx/.rbenv/versions/3.2.1/lib/ruby/3.2.0/bundler/rubygems_integration.rb:560:in `rubygems': Interrupt
[Info  - 3:59:32]   from /Users/xxx/.rbenv/versions/3.2.1/lib/ruby/3.2.0/bundler/shared_helpers.rb:57:in `pwd'
[Info  - 3:59:32]   from /Users/xxx/.rbenv/versions/3.2.1/lib/ruby/3.2.0/bundler/shared_helpers.rb:238:in `search_up'
[Info  - 3:59:32]   from /Users/xxx/.rbenv/versions/3.2.1/lib/ruby/3.2.0/bundler/shared_helpers.rb:137:in `print_major_deprecations!'
[Info  - 3:59:32]   from /Users/xxx/.rbenv/versions/3.2.1/lib/ruby/3.2.0/bundler/cli.rb:30:in `ensure in start'
[Info  - 3:59:32]   from /Users/xxx/.rbenv/versions/3.2.1/lib/ruby/3.2.0/bundler/cli.rb:30:in `start'
[Info  - 3:59:32]   from /Users/xxx/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/libexec/bundle:45:in `block in <top (required)>'
[Info  - 3:59:32]   from /Users/xxx/.rbenv/versions/3.2.1/lib/ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
[Info  - 3:59:32]   from /Users/xxx/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/bundler-2.4.6/libexec/bundle:33:in `<top (required)>'
[Info  - 3:59:32]   from /Users/xxx/.rbenv/versions/3.2.1/bin/bundle:25:in `load'
[Info  - 3:59:32]   from /Users/xxx/.rbenv/versions/3.2.1/bin/bundle:25:in `<main>'
[Info  - 3:59:32] /Users/xxx/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/typeprof-0.21.3/lib/typeprof/import.rb:9:in `initialize': undefined method `lockfile_of' for RBS::Collection::Config:Class (NoMethodError)
[Info  - 3:59:32] 
[Info  - 3:59:32]         collection_lock = RBS::Collection::Config.lockfile_of(collection_path)
tmk3s commented 6 months ago
スクリーンショット 2024-01-02 20 41 36

問題があると 入力補完起動しない

関係ないrbsファイル削除

スクリーンショット 2024-01-02 21 26 30

なんとかっしたい

tmk3s commented 6 months ago

typeprof

https://qiita.com/kagesumi3m/items/3cb56b50d587406f70b1 https://github.com/ruby/typeprof/blob/master/doc/ide.md#protips-limitation-unimplemented-features-

おそいらしいので一旦使わない想定で

tmk3s commented 6 months ago

docker-compose exec app rake rbs_rails:generate_rbs_for_models

で作成したrbsだとエラーにならない・・ => model_dependencies.rbsがないから名前解決できていない?

https://github.com/pocke/rbs_rails/blob/master/lib/rbs_rails/rake_task.rb#L29

modelは上記のコマンで背性するのがいい?

tmk3s commented 6 months ago

https://moneyforward-dev.jp/entry/2023/09/15/rbs-collection-basics-and-components

tmk3s commented 6 months ago
スクリーンショット 2024-01-03 21 31 37

現状devise_token_outhは gem 'devise_token_auth', :git => 'https://github.com/single-stop-tony/devise_token_auth' # トークン認証(https://github.com/lynndylanhurley/devise_token_auth/issues/1608#issuecomment-1783928862)

gitから取得しているからrbs collectionで取得できない?