smithy-lang / smithy-vscode

A Visual Studio Code extension to provide syntax highlighting for the Smithy IDL.
https://marketplace.visualstudio.com/items?itemName=smithy.smithy-vscode-extension
Apache License 2.0
37 stars 14 forks source link

[v0.5.1] Unresolved shapes unless opened once in the editor #61

Closed cayman-amzn closed 1 month ago

cayman-amzn commented 1 year ago

Not sure if this is an issue with the language server or the vscode extension so starting here.

Issue

When I start VSCode in my Smithy 2.0 package the LSP reports that all my custom shape are unresolved. Building the model works fine and there are no exceptions/warnings.

Opening the file that contains the shape definition fixes the issue, but reoccurs every time the editor is restarted.

Example

# src/foo.smithy
$version: "2"
namespace com.bing.bong

use com.bing.bong.util#TagSet

...

structure Blah {
  ...
  tags: TagSet, // Target: member shape targets an unresolved shape `com.bing.bong.util#TagSet`Smithy LSP
}
# src/util/Tag.smithy
$version: "2"
namespace com.bing.bong.util

...

structure Tag {
  key: String,
  value: String,
}

@uniqueItems
list TagSet {
  member: Tag,
}
ttop commented 1 year ago

I have this same issue. Very annoying if you have a many-file Smithy definition.

milesziemer commented 1 month ago

This is fixed in https://github.com/smithy-lang/smithy-vscode/releases/tag/0.6.0, assuming you have a smithy-build.json or .smithy-project.json that tells the extension/language server which smithy files are a part of your project.