Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Tokenisation of psalm array types #430

Open
@BladeMF

Description

@BladeMF

Summary

Psalm offers very widely supported syntax (by static analysis tools) for documenting array structure. Currently the tokeniser struggles with these forms:

  1. Space between the parameters
/**
* @return array<TKey, TValue>
*/
  1. Curly braces for defining object-like arrays
/**
* @return array{firstName:string, lastName:string}
*/
  1. Newline between the parameters
/**
* @return array{
*     firstName:string, 
*     lastName:string
* }
* 
*/

There's probably more cases missing. It will also be a good idea to tokenise the property name with a specific token so its name can be changed.

Motivation

Static analysis is a really powerful tool for avoiding errors, saving time and enforcing coding standards. It really sucks when the IDE is not colouring correctly the syntaxes needed for that analysis. It also provides really good visual feedback and a way of customising the colourisation of the tokens.

Describe alternatives you've considered

I am not aware of any way of customising that tokenisation.

Additional context

I am using VS Code.

Other

I am totally up for PRing this if it is OK to be contributor. I would probably need guidance with testing and setup though - I haven't contributed to a language grammar before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions