FuelLabs / FuelLabs/sway-vscode-plugin
Replace workspace view implementation with LSP calls
- Dominant language
- TypeScript
- Stars
- 51
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
[This PR](https://github.com/FuelLabs/sway-vscode-plugin/pull/69) added a sidebar panel with a workspace view, intended to show all sway files and their ABI methods, supporting workspaces with more than one Forc.toml.
The implementation is quite inefficient as it uses `readFileSync` and `contains` to naively find and display sway file contents. This should be replaced with calls to the sway LSP server.
An API that returns the following information would be enough to replace what's currently built:
```
type SwayFileType = 'contract' | 'script' | 'predicate' | 'library';
interface AbiMethod {
name: string;
}
interface SwayFile {
path: string;
type: SwayFileType;
abiMethods: AbiMethod[];
isEntrypoint: boolean;
}
interface ForcToml {
path: string;
authors: string;
entry: string;
name: string; // This is actually the only field that's currently needed
}
interface ForcProject {
forcToml: ForcToml
swayFiles: SwayFile[];
}
interface ForcWorkspace {
members: ForcProject
}
// API
getWorkspace(): ForcWorkspace
```
In the future we could add to the AbiMethods type, i.e.
```
interface AbiMethod {
name: string;
runnable: boolean;
argumentTypes: SwayType[];
returnType: SwayType;
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.