Comments (7)
Ah alright good to know, thank you for testing that! I also started on Ruby before finding Crystal, let me know if you have any questions about the language.
It's a limitation of the compiler currently, it removes anything not included in an executable (methods defined but never used, for example). Also due to type inference, the types can change depending on what's using the method (unless you've explicitly typed it like with your foo method). Specs are executables though, so that should work.
from vscode-crystal-lang.
Yes that was it 🙌
I installed crystalline
's binary with the command found in the repo's README, wrote the absolute path to that binary as the server's path in the Crystal Language
vscode extension's settings and reloaded VSCode.
Everything works fine as far as Types on hover and type errors go now.
Thank you @nobodywasishere
I could probably open a PR within the next couple of days to update the README if you'd like
from vscode-crystal-lang.
Thank you for the bug report! Currently type information can only be provided for methods / etc that are included in the final executable. Can you try doing this, and seeing if the hover works over the foo method call?
def foo : String
"hello"
end
puts foo # <-- here
It is weird though that there were no messages after "getting context...", I'll try to get a WSL2 system setup soon to see if I can reproduce.
from vscode-crystal-lang.
Thanks for the quick response 🙌
Printing doesn't seem to work either
Another detail is that the loading
tooltip only appear on the first hover after reloading vscode but if I unhover and hover again then no tooltip ever appear again until I reload vscode again
Currently type information can only be provided for methods / etc that are included in the final executable.
Is that something that is planned to be improved later on or a limitation coming from Crystal ? 🤔
I started using the language today so I was planning on making a bunch of small methods and test just to get to know the syntax and the differences with Ruby.
It'd be a bummer if I couldn't get type hints when doing something simple like
require "spec"
def foo : String
"hello"
end
describe "#foo" do
it "should return 'hello'" do
foo.should eq "hello"
end
end
from vscode-crystal-lang.
let me know if you have any questions about the language.
It's a bit early but I'll be sure to take you on that offer soon 👀 Thank you very much
from vscode-crystal-lang.
I just realized but it seems I'm not getting any type error either
Like on this screenshot, I assume I should have an error showing up in vscode saying that 1
is not of type String
right ?
Might be related to the LSP not loading properly.
LSP which btw no prints an additional error: undefined
line when hovering a value (this wasn't the case yesterday)
[Crystal] extension loaded
[Hover] getting context...
[Hover] error: undefined
[Hover] getting context...
[Hover] error: undefined
from vscode-crystal-lang.
So currently, you're not utilizing an LSP but instead wrappers for several compiler tools. I should provide better documentation but you need to install https://github.com/elbywan/crystalline somewhere and point the server
setting at it, then restart vscode.
You should be seeing type error information, looks like the problems tool isn't running for some reason. It's supposed to run every time you save or open a new file.
from vscode-crystal-lang.
Related Issues (20)
- Error executing Crystal plugin. spawn bash ENOENT in Windows HOT 1
- New release? HOT 20
- Supporting mutiple main files (entry points) for a single project HOT 4
- Hover feature does not work with Windows11 PC and v0.8.4 of the extension (Native Windows Crystal, not WSL) HOT 1
- With compiler path set properly still get error upon opening first .cr file HOT 1
- Dot in comments triggers autocomplete. HOT 3
- Crystalline server crashes if VSCode started with shortcut HOT 6
- Tasks don't support arbitrary files
- Use `spawn` instead of `exec` for formatting
- V 0.9 won't catch some errors HOT 1
- Syntax highlight mismatch for methods and variables HOT 3
- do autocompletes to DivisionByZero on ENTER HOT 8
- Non-variables starting with underscore are colored like comments
- Method names that start with a macro interpolation will show gray syntax highlighting HOT 1
- ECR formatting
- Not working when working from a parent DIR HOT 3
- Classes imported from shards throw a "undefined constant" error HOT 5
- After code is corrected and saved, previous error/problem is still persistent HOT 7
- Hover fails on fresh crystal install on Windows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-crystal-lang.