Replies: 4 comments
-
You've already gone relatively deep into my api. I am very pleased. some copy pasted code with no warranty:-) can be used in const vscode = require("vscode");
if(vscode){
const httpyacExtension = vscode.extensions.getExtension<HttpYacExtensionApi>('anweber.vscode-httpyac');
if (httpyacExtension?.isActive) {
const httpyacExtensionApi= httpyacExtension.exports;
httpyacExtensionApi.environmentChanged((env: Array<string> |undefined) => {
// ... fix my environment and rule the world code
httpyacExtensionApi.documentStore.documentStoreChangedEmitter.fire();
});
} This solution works only for VSCode. I would additionally implement a To test if your change does work, you could view internal httpFile object in my debug tree provider. |
Beta Was this translation helpful? Give feedback.
-
@wusawo One more question, because I thought about it again. Why do you actually make new environments that are selected with instead of just reacting to the existing environments and adding your logic there. Several variable providers are allowed to supply variables for an environment at the same time, that would simplify the whole construct. |
Beta Was this translation helpful? Give feedback.
-
@AnWeber sorry for my late response. Thank you for your additional thoughts
That gives the following relationship:
I liked the idea of creating a custom env provider for these test data sets. It allows building test data with complex (and even nested) objects and all available Javascript types (instead of only string values). It nicely integrates in the httpyac vscode UI. I can easily select Meanwhile I was able to select the necessary runtime environment for a selected test data set by following your hint and implementing a listener for the BTW: I was wondering about the differences between the |
Beta Was this translation helpful? Give feedback.
-
In JSON Files no script usage is possible. Some developers prefer using json files because of security concerns. Webpack, Eslint, ... all provide options to allow only json configurations. I just mimicked this tooling.
httpyac.config.js is executed on every change in a http file (every parse). If I cache the script execution, I would need to detect updated configuration and script files. It was just too complicated for a minor win. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have implemented an additional custom environment and variables provider local to my project by using the hooks
provideEnvironments
andprovideVariables
. There is a dependency between a custom environment and another environment (realized with the default httpyac environment functionality).Is there a chance to additionally select (set active) the related environment when the vscode user activates one of my custom environments (by toggle environment command, codelens, environment window and so on). I have already tried to set
context.httpFile.activeEnvironment
from withinprovideEnvironments
andprovideVariables
of my custom environment provider. The the toggle environment dialog was never updated accordingly; whereas the codelens environment was updated after some time / after some interaction. Also I am not sure if the variables of the related environment are loaded reliably because they are not shown in the variables window but with the show variables command.Thanks for any hints
Beta Was this translation helpful? Give feedback.
All reactions