Open wJoenn opened 4 months ago
This is probably due to the wrong main file being set. Some fixes should be coming soon but in the meantime can you post the contents of the crystal output channel when this happens, and your projects file structure?
Output
[Crystal] loading lsp /home/joenn/.asdf/plugins/crystal/bin/crystalline
[Info - 11:37:35 PM] LSP server is ready.
[Spec] (kemal) $ /home/joenn/.asdf/shims/crystal spec --junit_output /tmp/202433-2488-qk5rfi.6yvnj.xml --no-color --dry-run
File Structure
|-- ROOT
| |-- bin
| |-- config
| | |-- initializers
| | | |-- cors.cr <-- undefined constant Kemal::Handler error
| | | |-- database.cr <-- require jennifer here
| | |-- config.cr <-- require Kemal then all initializers here
| |-- db
| | |-- migrations
| | | |-- create_tasks.cr <-- undefined constant Jennifer::Migration::Base error
| |-- lib
| | |-- jennifer
| | |-- kemal
| |-- spec
| |-- src
| | |-- controller
| | |-- models
| | | |-- user.cr <-- undefined constant Jennifer::Model::Base error
| | |-- services
| | |-- app.cr <-- require config/config.cr
| |-- shards.lock
| |-- shards.yml
Not that all the errors I get are from classes I inherit from.
class CorsHandler < Kemal::Handler
end
class CreateTasks < Jennifer::Migration::Base
end
class User < Jennifer::Model::Base
end
As you're using Crystalline, the issue either lies with that or with how you've set it up. Do these errors still come up when the LSP is disabled?
I don't get those errors when disabling Crystalline but then I'm back to this issue https://github.com/crystal-lang-tools/vscode-crystal-lang/issues/185
When using crystalline, try setting an entrypoint using the process described here
Describe the bug I have a small api that uses the
jennifer
ORMThe shard is required from it's initializer file
Which itself is imported by the config file
But in my
Task
model I get an error saying theJennifer::Model::Base
class is undefinedThe code works though as tests passes
This is true for any class coming from an installed shard which is not required in the file it's being used as far as I can tell
To Reproduce Create a directory, install shard, require it in a config file and use it from a file that requires the config file
Expected behavior It shouldn't throw an error
Screenshots
Desktop (please complete the following information):