ksprojects / protobuf-jetbrains-plugin

Protobuf Support for JetBrains IDEs
https://plugins.jetbrains.com/plugin/8277
Apache License 2.0
259 stars 45 forks source link

Error when using square brackets in third party extension #136

Closed ethiery closed 4 years ago

ethiery commented 5 years ago

Describe the bug The plugin currently highlights closing brackets in extensions as errors.

To Reproduce I came across this bug using protoc-gen-validate Steps to reproduce the behavior:

  1. Install protoc-gen-validate
  2. Add $GOPATH/src/github.com/lyft/protoc-gen-validate to include paths of the plugin.
  3. Open any protobuf definition file using brackets in an extension, such as:
    
    syntax = "proto3";

import "validate/validate.proto";

package myproto;

message MyMessage { MyEnum enum = 1 [(validate.rules).enum = {not_in: [0]}]; }

enum MyEnum { ZERO = 0; ONE = 1; }



**Expected behavior**
No syntax error.

**Screenshots**
![image](https://user-images.githubusercontent.com/13584434/55324112-0305d280-5479-11e9-9544-232ba7ec3a1d.png)

**Plugin (please complete the following information):**
 - OS: Ubuntu 18.04
 - Plugin version: 0.13.0
 - IDE: GoLang 2019.1 / IntelliJ iDEA Ultimate 2019.1
mennanov commented 5 years ago

I also get a similar error with the following proto:

message RegisterRequest {
    string username = 1 [(shared.proto.validator.field) = {regex: "^[a-z0-9_]{3,32}$"}];  // <- OK here
    string email = 2 [(shared.proto.validator.field) = {regex: "^.+@.+$", length_lt: 101}]; // error here
    string password = 3 [(shared.proto.validator.field) = {msg_exists: true, length_gt: 7}]; // also an error here
}

The plugin incorrectly complains about the "," symbol: <missing '}'> and then it fails to parse everything that follows this comma.

vwagner commented 5 years ago

Even worse: if you then try to reformat the code in this case, you end up with a severely jumbled file, with one symbol per line

Screen Shot 2019-10-16 at 3 28 08 PM
ghost commented 5 years ago

I think this is the same issue. Second line always gets me error(the foo.bar errors only because it is non existent example): foobar

kshchepanovskyi commented 4 years ago

This issue is closed as plugin is not supported anymore. Please switch to https://github.com/jvolkman/intellij-protobuf-editor.