'Using yarn workspaces, VSCode does not auto suggest imports from different packages

This is my setup:

packages
  admin
    package.json // Has a dependency to @packages/common
  common
  user
package.json

When I'm working in the admin package files, I want to have auto imports suggestions for the common package. That's not currently working.

Obs: if I manually type the import, it works.

Which tool is responsible to do the auto import? Is it eslint or regular VSCode TypeScript intellisense? Not sure exactly where to look for a solution here.

Which configuration should I have in place to achieve this?

I'm also using eslint and eslint-import-resolver-typescript


UPDATE

What is weird is that auto import suggestions works for types coming from the common package, but not for actual variables and constants.



Solution 1:[1]

First convert the time you receive as a string to a time.Time object:

t, err := time.Parse("2006-01-02T15:04:05", val)

Here "2006-01-02T15:04:05" represents the layout you expect.

Then you can use timestamppb built-in function to create a protobuf timestamp from a time.Time object:

tpb := timestamppb.New(t)

If you need the opposite, you can use AsTime from timestampb.Timestamp type and then format from time.Time object to make a string.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Benjamin Barrois