Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension does not react to flow.json changes #314

Closed
jribbink opened this issue May 6, 2023 · 0 comments · Fixed by #329
Closed

Extension does not react to flow.json changes #314

jribbink opened this issue May 6, 2023 · 0 comments · Fixed by #329
Assignees
Labels
bug Something isn't working

Comments

@jribbink
Copy link
Contributor

jribbink commented May 6, 2023

Instructions

Issue To Be Solved

The configuration is only read from the disk the first time the loadConfig is called and then stored globally.

export async function loadConfig (filePath?: string): Promise<FlowConfig> {
if (flowConfig === undefined) {
let flowJsonPath = ''
if (filePath !== undefined) {
flowJsonPath = filePath
} else {
flowJsonPath = await getConfigPath()
}
const fc: FlowConfig = JSON.parse(fs.readFileSync(flowJsonPath, 'utf-8'))
flowConfig = fc
}
return flowConfig
}

This is problematic since the user will inevitably change their configuration file throughout the course of working on a project.

(Optional): Suggest A Solution

We should probably load the configuration every time we use it or use a file watcher like chokidar in order to update our configuration in memory every time flow.json changes.

However, I am strongly in favour of leaving the flow.json parsing to the language server side of things as we don't really need to be using it in the client at all (See #313). If this were done, this issue would be irrelevant.

(Optional): Context

Issues when changing flow.json keys/accounts & trying to restart emulator.

@jribbink jribbink added the bug Something isn't working label May 6, 2023
@jribbink jribbink self-assigned this May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants