microsoft / microsoft/typespec
[Bug]: Extension does not handle nested path imports
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
### Describe the bug
I have a tspconfig level import in imports array. It should include imports to all files but when i use in nested files like `/some-folder/some.tsp` then it will compiles correctly, but the vs code extenstion will not show it correct and autocomplete fail.
### Reproduction
In my tspconfig.yaml
```yaml
imports:
- myfavorite.tsp
```
there is an import with a content of:
`myfavorite.tsp`
```ts
model Problem {
title: string;
detail: string;
type: string;
instance: string;
}
```
I have a `main.tsp` on root level which will be compiled,
```ts
import "@typespec/http";
import "@typespec/openapi";
import "@typespec/openapi3";
import "v1/some-example-endpoint";
using Http;
using OpenAPI;
/**
* User-facing API of Axoflow
*/
@service({
title: "UI API",
})
@info({
version: "1.0.0",
contact: {
name: "UI API",
},
})
namespace UIAPI;
```
but my endpoints is nested into `v1/some-example-endpoint` path
`main.tsp`
```ts
namespace UIAPI;
@route("/api/v1/some-example-endpoint")
op returnSomeProblem(): Problem;
```
The problem is the extension will add the red underline, but the compiler compiles correctly.
The imports array will work for extenasion on root level `main.tsp` but only there, not in the subpaths.
### Checklist
- [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md)
- [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions).
- [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Contributor guide
Assessment
This issue has not been assessed yet.