question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Imports are not working

See original GitHub issue

Here’s how to reproduce:

create a file date.proto

syntax = "proto3";

message Date {
  // Year of date. Must be from 1 to 9999, or 0 if specifying a date without
  // a year.
  int32 year = 1;

  // Month of year. Must be from 1 to 12.
  int32 month = 2;

  // Day of month. Must be from 1 to 31 and valid for the year and month, or 0
  // if specifying a year/month where the day is not significant.
  int32 day = 3;
}

create a file foo.proto

syntax = "proto3";

import "date.proto";

message Foo {
    Date date = 1;
}

You’ll get an error saying Date is undefined. Compiling with protoc itself works though…

I’m creating a course on Protobuf and I’m recommending your plugin, but that error is a roadblock to properly recording the video. Any chance you know how to solve this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
justfaltercommented, Feb 22, 2019

Doing some debugging on vscode 1.31.1 on OSX with vscode-proto3 0.2.2 (code --inspect-extensions 12345, and then attaching using chrome debug tools), I can see that when vscode-proto3 gets to here: https://github.com/zxh0/vscode-proto3/blob/7fa48c3f4093b8537705207d99d42f1302620b10/src/proto3Compiler.ts#L71 , all of the paths have been expanded to absolute paths. For example, with:

"protoc": {
    "options": ["--proto_path=lib/proto", "--cpp_out=gen"]
}

The value of args being passed to execFile is

[
    "--proto_path=/abs/path/to/lib/proto",
    "--cpp_out=/abs/path/to/gen",
    "rel/path/to/my.proto"
]

This is expected to be the following for protoc 3.6.1 to work:

[
    "--proto_path=proto",
    "--cpp_out=gen",
    "rel/path/to/my.proto"
]
0reactions
nevircommented, Jan 30, 2019

Running into similar issues. Is there a way of observing what protoc is being called with, and its output?

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Import not Working - Stack Overflow
Let's say a.py is part of the library, b is the user's program that uses the library, and I wrote the library. If...
Read more >
import * as not working · Issue #36983 · angular ... - GitHub
I am using this utils to show configuration and run local test, It is working fine as a standalone (without angular). URL :...
Read more >
5. The import system — Python 3.11.1 documentation
Python code in one module gains access to the code in another module by the process of importing it. The import statement is...
Read more >
Traps for the Unwary in Python's Import System
I'm using a similar layout described here and using explicit relative imports in my tests, however I'm running into numerous problems when I...
Read more >
Auto import | IntelliJ IDEA Documentation - JetBrains
Basic procedures to create and optimize imports in IntelliJ IDEA. Learn more how to import the missing import or XML namespace.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found