Closed LLCampos closed 4 years ago
Hi, thanks for reporting. I wasn't able to reproduce your example unfortunately.
Could you please try to:
routes
file from this example project https://github.com/tomas-milata/intelliroutes-reproduce-issue-9.routes
file run a PSI Dump to clipboard action and send the output. E.g. by right clicking in the text editor > PSI Viewer > PSI Dump to clipboard. It should give you output similar to this:Routes File(0,102)
RoutesRouteImpl(ROUTE)(0,101)
PsiElement(HTTP verb)('POST')(0,4)
PsiWhiteSpace(' ')(4,5)
RoutesPathImpl(PATH)(5,18)
PsiElement(/)('/')(5,6)
RoutesPathSegmentImpl(PATH_SEGMENT)(6,18)
PsiElement(static path segment)('someEndpoint')(6,18)
PsiWhiteSpace(' ')(18,19)
RoutesCallImpl(CALL)(19,101)
PsiElement(controller method)('@controllers.UserEntitlementsController.someMethod')(19,69)
PsiElement(()('(')(69,70)
RoutesArgumentsImpl(ARGUMENTS)(70,100)
RoutesArgumentImpl(ARGUMENT)(70,84)
PsiElement(argument name)('Argument1')(70,79)
PsiElement(:)(':')(79,80)
PsiWhiteSpace(' ')(80,81)
PsiElement(argument type)('Int')(81,84)
PsiElement(,)(',')(84,85)
PsiWhiteSpace(' ')(85,86)
RoutesArgumentImpl(ARGUMENT)(86,100)
PsiElement(argument name)('Argument2')(86,95)
PsiElement(:)(':')(95,96)
PsiWhiteSpace(' ')(96,97)
PsiElement(argument type)('Int')(97,100)
PsiElement())(')')(100,101)
PsiElement(new line)('\n')(101,102)
routes
file should probably be enough.I get errors on that example project.
The dump:
Play2RoutingFile(0,102)
Play2ScalaPsiStub(ROUTING_LINE)(0,101)
PsiElement(HTML_METHOD_NAME)('POST')(0,4)
PsiWhiteSpace(' ')(4,5)
Play2URIPath(ROUTING_PATH)(5,18)
PsiElement(PATH_SLASH)('/')(5,6)
Play2ScalaPsiNamedUrlPart(ROUTING_STATIC_REGEXP)(6,18)
PsiElement(PATH_STATIC_IDENTIFIER)('someEndpoint')(6,18)
PsiWhiteSpace(' ')(18,19)
PsiElement(MANUALLY_MANAGED_AT)('@')(19,20)
MethodCall(20,101)
ReferenceExpression: controllers.UserEntitlementsController.someMethod(20,69)
ReferenceExpression: controllers.UserEntitlementsController(20,58)
ReferenceExpression: controllers(20,31)
PsiElement(identifier)('controllers')(20,31)
PsiElement(.)('.')(31,32)
PsiElement(identifier)('UserEntitlementsController')(32,58)
PsiElement(.)('.')(58,59)
PsiElement(identifier)('someMethod')(59,69)
ArgumentList(69,101)
PsiElement(()('(')(69,70)
TypedStatement(70,84)
ReferenceExpression: Argument1(70,79)
PsiElement(identifier)('Argument1')(70,79)
PsiElement(:)(':')(79,80)
PsiWhiteSpace(' ')(80,81)
SimpleType: Int(81,84)
CodeReferenceElement: Int(81,84)
PsiElement(identifier)('Int')(81,84)
PsiElement(,)(',')(84,85)
PsiWhiteSpace(' ')(85,86)
TypedStatement(86,100)
ReferenceExpression: Argument2(86,95)
PsiElement(identifier)('Argument2')(86,95)
PsiElement(:)(':')(95,96)
PsiWhiteSpace(' ')(96,97)
SimpleType: Int(97,100)
CodeReferenceElement: Int(97,100)
PsiElement(identifier)('Int')(97,100)
PsiElement())(')')(100,101)
PsiWhiteSpace('\n')(101,102)
Other scenarios:
def someMethod(Argument1: Int): Action[AnyContent] = {
Action(Ok("hello"))
}
Play2RoutingFile(0,86)
Play2ScalaPsiStub(ROUTING_LINE)(0,85)
PsiElement(HTML_METHOD_NAME)('POST')(0,4)
PsiWhiteSpace(' ')(4,5)
Play2URIPath(ROUTING_PATH)(5,18)
PsiElement(PATH_SLASH)('/')(5,6)
Play2ScalaPsiNamedUrlPart(ROUTING_STATIC_REGEXP)(6,18)
PsiElement(PATH_STATIC_IDENTIFIER)('someEndpoint')(6,18)
PsiWhiteSpace(' ')(18,19)
PsiElement(MANUALLY_MANAGED_AT)('@')(19,20)
MethodCall(20,85)
ReferenceExpression: controllers.UserEntitlementsController.someMethod(20,69)
ReferenceExpression: controllers.UserEntitlementsController(20,58)
ReferenceExpression: controllers(20,31)
PsiElement(identifier)('controllers')(20,31)
PsiElement(.)('.')(31,32)
PsiElement(identifier)('UserEntitlementsController')(32,58)
PsiElement(.)('.')(58,59)
PsiElement(identifier)('someMethod')(59,69)
ArgumentList(69,85)
PsiElement(()('(')(69,70)
TypedStatement(70,84)
ReferenceExpression: Argument1(70,79)
PsiElement(identifier)('Argument1')(70,79)
PsiElement(:)(':')(79,80)
PsiWhiteSpace(' ')(80,81)
SimpleType: Int(81,84)
CodeReferenceElement: Int(81,84)
PsiElement(identifier)('Int')(81,84)
PsiElement())(')')(84,85)
PsiWhiteSpace('\n')(85,86)
Play2RoutingFile(0,90)
Play2ScalaPsiStub(ROUTING_LINE)(0,89)
PsiElement(HTML_METHOD_NAME)('POST')(0,4)
PsiWhiteSpace(' ')(4,5)
Play2URIPath(ROUTING_PATH)(5,18)
PsiElement(PATH_SLASH)('/')(5,6)
Play2ScalaPsiNamedUrlPart(ROUTING_STATIC_REGEXP)(6,18)
PsiElement(PATH_STATIC_IDENTIFIER)('someEndpoint')(6,18)
PsiWhiteSpace(' ')(18,19)
PsiElement(MANUALLY_MANAGED_AT)('@')(19,20)
MethodCall(20,89)
ReferenceExpression: controllers.UserEntitlementsController.someMethod(20,69)
ReferenceExpression: controllers.UserEntitlementsController(20,58)
ReferenceExpression: controllers(20,31)
PsiElement(identifier)('controllers')(20,31)
PsiElement(.)('.')(31,32)
PsiElement(identifier)('UserEntitlementsController')(32,58)
PsiElement(.)('.')(58,59)
PsiElement(identifier)('someMethod')(59,69)
ArgumentList(69,89)
PsiElement(()('(')(69,70)
AssignStatement(70,88)
ReferenceExpression: Argument1(70,79)
PsiElement(identifier)('Argument1')(70,79)
PsiElement(:)(':')(79,80)
PsiWhiteSpace(' ')(80,81)
SimpleType: Int(81,84)
CodeReferenceElement: Int(81,84)
PsiElement(identifier)('Int')(81,84)
PsiWhiteSpace(' ')(84,85)
PsiElement(=)('=')(85,86)
PsiWhiteSpace(' ')(86,87)
LITERAL(87,88)
PsiElement(integer)('2')(87,88)
PsiElement())(')')(88,89)
PsiWhiteSpace('\n')(89,90)
IntelliJ IDEA 2019.3.3 (Ultimate Edition)
Build #IU-193.6494.35, built on February 11, 2020
Licensed to Luis Campos
Subscription is active until February 28, 2020
Runtime version: 11.0.5+10-b520.38 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-76-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 1925M
Cores: 8
Registry:
Non-Bundled Plugins: Karma, PsiViewer, Pythonid, org.intellij.scala, com.github.tomasmilata.intelliroutes, com.intellij.lang.puppet, de.netnexus.camelcaseplugin, mobi.hsz.idea.gitignore, org.jetbrains.plugins.hocon, org.jetbrains.plugins.ruby
Thanks for providing the details.
The problem in your case is that the scala plugin in IntelliJ Ultimate has built-in support for Play (unlike the Community version) and as a result, both plugins are trying to associate their editors with routes
files. So what you are seeing is actually a routes file editor from the Scala plugin, not this one.
I am not sure how to handle conflicting file associations on my side at the moment, so I'd recommend:
either associating routes files to my plugin using File > Associate with File Type > edit the file pattern to *.routes
(or any other pattern you'd like to associate) > select Play Framework Routes
or filing a bug in the Scala plugin (I believe it's https://plugins.jetbrains.com/plugin/1347-scala) and using just that plugin
Thanks!
Here is what worked for me:
File -> Settings -> Editor -> File Types
Html Routing Support For Play 2 Framework
Play Framework Routes
routes
to Registered patterns
Great, thanks for sharing this!
The following method is in a controller:
But this happens:
I wouldn't expect the
Argument2
to be red.