Skip to content

Commit

Permalink
prettier fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel OBrien committed Jan 30, 2024
1 parent c743b20 commit 0ecb37c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 34 deletions.
21 changes: 11 additions & 10 deletions src/configurationMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,18 @@ export class ConfigurationMenu {
async pickProject(input: MultiStepInput<QuickPickItem>, state: CMState) {
const session = await authentication.getSession('launchdarkly', ['writer'], { createIfNone: false });
if (session === undefined) {
const selection = await window
.showInformationMessage(
'You are not logged into LaunchDarkly. Please sign in to LaunchDarkly to continue.',
'Sign In',
)
if (selection) {
if (selection === 'Sign In') {
const session = await authentication.getSession('launchdarkly', ['writer'], { createIfNone: true }) as LaunchDarklyAuthenticationSession;
this.config.setSession(session);
}
const selection = await window.showInformationMessage(
'You are not logged into LaunchDarkly. Please sign in to LaunchDarkly to continue.',
'Sign In',
);
if (selection) {
if (selection === 'Sign In') {
const session = (await authentication.getSession('launchdarkly', ['writer'], {
createIfNone: true,
})) as LaunchDarklyAuthenticationSession;
this.config.setSession(session);
}
}
}
const projectOptions: QuickPickItem[] = [
{ label: 'Retrieving projects...it may take a moment.', description: '', detail: '' },
Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ export async function activate(ctx: ExtensionContext): Promise<void> {
}

if ((ctx.secrets.get('launchdarkly_accessToken') || semver.lt(storedVersion, '4.99.10')) && session === undefined) {
//if (semver.lt(storedVersion, '4.99.1')) {
//if (semver.lt(storedVersion, '4.99.1')) {
window
.showInformationMessage(
`LaunchDarkly: Please [Sign In](command:vscode-launchdarkly-authprovider.signIn) as part your extension update.`,
`Sign In`
`Sign In`,
)
.then(async (item) => {
switch (item) {
Expand Down
2 changes: 1 addition & 1 deletion src/providers/authProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export class LaunchDarklyAuthenticationProvider implements AuthenticationProvide
}
// If secret existed in secret store, it's now moved to session.
await this.context.secrets.delete('launchdarkly_accessToken');

return { access_token: updatedToken, refresh_token: '', baseUri: appBaseUri };
}

Expand Down
4 changes: 1 addition & 3 deletions src/providers/codeRefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ export class FlagAliases {
if (!session || !intConfig) {
return;
}
const apiToken = legacyAuth()
? session.accessToken
: `Bearer ${session.accessToken}`;
const apiToken = legacyAuth() ? session.accessToken : `Bearer ${session.accessToken}`;
try {
const codeRefsBin = await this.getCodeRefsBin();
const command = `${codeRefsBin} --dir="${directory}" --dryRun --outDir="${outDir}" --projKey="${intConfig.project}" --repoName="${repoName}" --baseUri="${session.fullUri}" --contextLines=-1 --branch=scan --revision=0`;
Expand Down
11 changes: 8 additions & 3 deletions src/providers/flagListView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,14 @@ export class LaunchDarklyFlagListProvider implements TreeDataProvider<TreeItem>
newElement.list = [codelensFlag.range];
this.flagNodes.push(newElement);
} else {
newElement = new FlagItem(codelensFlag.flag, TreeItemCollapsibleState.Collapsed, codelensFlag.flag, [
codelensFlag.range,
], null, 'FlagItem');
newElement = new FlagItem(
codelensFlag.flag,
TreeItemCollapsibleState.Collapsed,
codelensFlag.flag,
[codelensFlag.range],
null,
'FlagItem',
);
}
logDebugMessage(`Setting Flag: ${JSON.stringify(codelensFlag)}`);
this.flagMap.set(codelensFlag.flag, newElement);
Expand Down
18 changes: 4 additions & 14 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,20 @@ export async function setupComponents(config: LDExtensionConfiguration, reload =
const flagView = new LaunchDarklyTreeViewProvider(config);
const codeLens = new FlagCodeLensProvider(config);

const enableFlagListView = workspace.getConfiguration('launchdarkly').get('enableFlagsInFile', false)
const enableFlagListView = workspace.getConfiguration('launchdarkly').get('enableFlagsInFile', false);
let listViewDisp = Disposable.from();
if (enableFlagListView) {
const listView = new LaunchDarklyFlagListProvider(config, codeLens);
window.registerTreeDataProvider('launchdarklyFlagList', listView);
listViewDisp = commands.registerCommand('launchdarkly.refreshFlagLens', () => listView.setFlagsinDocument());
config
.getCtx()
.subscriptions.push(
window.onDidChangeActiveTextEditor(listView.setFlagsinDocument),
listViewDisp
);
config.getCtx().subscriptions.push(window.onDidChangeActiveTextEditor(listView.setFlagsinDocument), listViewDisp);
}


const enableReleasesView = workspace.getConfiguration('launchdarkly').get('enableReleasesView', false)
const enableReleasesView = workspace.getConfiguration('launchdarkly').get('enableReleasesView', false);
if (enableReleasesView) {
const releaseView = new LaunchDarklyReleaseProvider(config);
window.registerTreeDataProvider('launchdarklyReleases', releaseView);
}


config.setFlagView(flagView);

Expand All @@ -98,16 +91,13 @@ export async function setupComponents(config: LDExtensionConfiguration, reload =
treeDataProvider: flagView,
}),
);



const LD_MODE: DocumentFilter = {
scheme: 'file',
};
const hoverProviderDisp = languages.registerHoverProvider(LD_MODE, new LaunchDarklyHoverProvider(config));

try {

const flagToggle = commands.registerCommand('launchdarkly.toggleFlagCmdPrompt', async () => {
await showToggleMenu(config);
});
Expand Down Expand Up @@ -311,6 +301,6 @@ function createFallthroughOrOffInstruction(kind: string, variationId: string) {
}

export function legacyAuth() {
return true;
return true;
//workspace.getConfiguration('launchdarkly').get('legacyAuth', false)
}
2 changes: 1 addition & 1 deletion test/providers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const flag = new FeatureFlag({
clientSideAvailability: {
usingMobileKey: false,
usingEnvironmentId: false,
}
},
});

const flagConfig: FlagConfiguration = {
Expand Down

0 comments on commit 0ecb37c

Please sign in to comment.