asedunov / intellij-crystal-lang Goto Github PK
View Code? Open in Web Editor NEWAn IntelliJ plugin for Crystal language
License: Apache License 2.0
An IntelliJ plugin for Crystal language
License: Apache License 2.0
Paths:
Reopening:
Inheritance:
Enums:
None
member to non-zeroAll
memberAnnotation (general):
Extern
annotation (structs):
union
with boolean literal as it valueLink
annotation (libraries):
lib
(a string literal), ldflags
(a string literal), static
(a boolean literal), framework
(a string literal) and pkg_config
(a string literal). They may be passed as positional in the specified order (except pkg_config
which must be named), named or using mixed notationCallConvention
annotation (libraries):
LLVM::CallConvention
valuesReference:
https://github.com/crystal-lang/crystal/blob/master/src/compiler/crystal/semantic/semantic_visitor.cr
https://github.com/crystal-lang/crystal/blob/master/src/compiler/crystal/semantic/top_level_visitor.cr
require "./benchmarks"
require "./objects"
require "./symbols"
require "./lexer"
require "option_parser"
It shows Cannot resolve file 'option_parser.cr'
but option_parser
comes from the Crystal SDK
If you want to check, you can use my project https://github.com/MarioAriasC/monyet/blob/main/src/monyet.cr
Cheers
E.g. X should be resolvable here:
macro foo
class X
end
end
foo
x = X.new
Currently macro bodies are represented as opaque strings. The goal is to parse their content and inject into the original literal to enable highlighting, resolve and all available code insight features
just getting started with Crystal, installed it via homebrew, trying to create a project but can't find a folder which this plugin will accept but none seems to fit :/
os: Monterey 13.3.1 (Apple Silicon)
crystal: 1.8.0
shards: 0.17.3
plugin: 0.7-2023.1
output of /opt/homebrew/opt/crystal/bin/crystal env
:
CRYSTAL_CACHE_DIR=/Users/user/.cache/crystal
CRYSTAL_PATH=lib:/opt/homebrew/Cellar/crystal/1.8.0/libexec/../share/crystal/src
CRYSTAL_VERSION=1.8.0
CRYSTAL_LIBRARY_PATH=/opt/homebrew/Cellar/crystal/1.8.0/libexec/../../../../lib
CRYSTAL_OPTS=''
running the project with empty path gives:
/opt/homebrew/Cellar/crystal/1.8.0/bin/crystal run --progress /Users/user/dev/tmp/crtest/src/p3415crtest.cr
Showing last frame. Use --error-trace for full trace.
In Users/user/dev/tmp/crtest/src/p3415crtest.cr:1:1
1 | # TODO: Write documentation for `P3415crtest`
^
Error: can't find file 'prelude'
Many icons are OK since they taken from the platform itself and change automatically when user switches on the "New UI", but some (like module's) are provided by plugin and must be accompanied by newer versions
Add page to "New Project" wizard to create stub application/library project similar to crystal init
command
Didn't know how better to phrase this one, but seeing as you're working so quickly I figured I throw this small issue at you. Right now there's one major issue I've noticed in the syntax highlighting, and that's that chained function calls have each part of the chain highlighted with the same color, which doesn't look great.
With the Ruby syntax highlighting in RubyMine, and the Crystal syntax highlighting in VS Code it looks like this which breaks up the monotony a bit and makes things easier to read.
Noob question 2: how do I add the "build" configuration?
Just naively adding "build" to compiler parameters gets me
/opt/homebrew/Cellar/crystal/1.8.0/bin/crystal run --progress build /Users/user/dev/tmp/crtest/src/p3415crtest.cr
which predictably results in
Error: file 'build' does not exist
upd: for posterity
os: Monterey 13.3.1 (Apple Silicon)
crystal: 1.8.0
shards: 0.17.3
plugin: 0.7-2023.1
Cases to support:
In project settings we can suggest Crystal installations (via scoop) similar to how it's done for WSL
Current cases:
When I try to see the structure of this file this file: https://github.com/MarioAriasC/monyet/blob/main/src/parser.cr
java.lang.NullPointerException
at org.crystal.intellij.psi.CrProcType.getInputList(CrProcType.kt:20)
at org.crystal.intellij.presentation.CrystalDefinitionPresentationBase.appendType(CrystalDefinitionPresentationBase.kt:91)
at org.crystal.intellij.presentation.CrystalDefinitionPresentationBase.appendRHS(CrystalDefinitionPresentationBase.kt:66)
at org.crystal.intellij.presentation.CrystalDefinitionPresentationBase.getPresentableText(CrystalDefinitionPresentationBase.kt:20)
at org.crystal.intellij.presentation.CrystalDefinitionPresentationBase.getPresentableText(CrystalDefinitionPresentationBase.kt:15)
at com.intellij.ide.projectView.PresentationData.updateFrom(PresentationData.java:168)
at com.intellij.ide.util.treeView.smartTree.TreeElementWrapper.update(TreeElementWrapper.java:42)
at com.intellij.ide.util.treeView.PresentableNodeDescriptor.getUpdatedPresentation(PresentableNodeDescriptor.java:78)
at com.intellij.ide.util.treeView.PresentableNodeDescriptor.update(PresentableNodeDescriptor.java:30)
at com.intellij.ui.tree.StructureTreeModel$Node.update(StructureTreeModel.java:455)
at com.intellij.ui.tree.StructureTreeModel$Node.<init>(StructureTreeModel.java:436)
at com.intellij.ui.tree.StructureTreeModel$Node.<init>(StructureTreeModel.java:429)
at com.intellij.ui.tree.StructureTreeModel.getValidChildren(StructureTreeModel.java:390)
at com.intellij.ui.tree.StructureTreeModel.validateChildren(StructureTreeModel.java:299)
at com.intellij.ui.tree.StructureTreeModel$Node.isLeaf(StructureTreeModel.java:559)
at com.intellij.ui.tree.StructureTreeModel.isLeaf(StructureTreeModel.java:335)
at com.intellij.ui.tree.LeafState.get(LeafState.java:64)
at com.intellij.ui.tree.AsyncTreeModel$CmdGetChildren.load(AsyncTreeModel.java:574)
at com.intellij.ui.tree.AsyncTreeModel$CmdGetChildren.getNode(AsyncTreeModel.java:547)
at com.intellij.ui.tree.AsyncTreeModel$Command.get(AsyncTreeModel.java:440)
at com.intellij.ui.tree.AsyncTreeModel$Command.get(AsyncTreeModel.java:406)
at com.intellij.util.concurrency.Invoker$Task.run(Invoker.java:316)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1084)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:75)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:158)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:115)
at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:57)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:624)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:623)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:57)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:112)
at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:75)
at com.intellij.util.concurrency.Invoker.invokeSafely(Invoker.java:205)
at com.intellij.util.concurrency.Invoker.lambda$offerSafely$0(Invoker.java:183)
at com.intellij.util.concurrency.Invoker$Background.lambda$offer$0(Invoker.java:486)
at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:246)
at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:32)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:225)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:213)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:214)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:829)
Inspections to add:
See shards.yml specification for reference
For example, the code
Foo { a: 123 }
should be converted to
Foo { "a" => 123 }
In the example below both references to C
should be resolved
module M
class C
end
end
a = C.new
include M
b = C.new
Crystal compiler reports error when case
-expressions contains duplicate conditions in when
/in
. For example the code above should be highlighted as red:
case x; when {1, 2}; 2; when {1, 2}; end
\{{...}}
syntax in macro inside comments (crystal-lang/crystal@a37e5df)Int64
's range (crystal-lang/crystal@8b801a5)This can be used for checking of enum constants and static arrays
As of 1.3 expression splat can only be used as:
a.b = (*c)
which is semantically is also a call of b=
methodIn 1.4 it's also allowed to use splats as assignment left-hand side (e.g. *a = b, c
). This case is covered by #11
I received new versions of this plugin (see https://plugins.jetbrains.com/plugin/17578-crystal/versions) which seem to be out-of-sync with this GitHub repository.
It would be nice if I could read up, what changed in a CHANGELOG.md here at GitHub (if the plugin is still open source).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.