launchdarkly / ld-vscode

VSCode extension for LaunchDarkly
https://www.launchdarkly.com
Other
17 stars 8 forks source link

[Feature Request] Support `launchdarkly-react-client-sdk` in Flags in this File feature #122

Open SevenOutman opened 2 months ago

SevenOutman commented 2 months ago

Hey team, thanks for making this tool!

Currently, if I'm in a file where I reference a flag from the deconstruction of useFlags() result, it does not appear in the Flags in this File panel. Any plan we support this?

import { useFlags } from 'launchdarkly-react-client-sdk';

function App() {
  const { myFlag } = useFlags() // Expect my-flag to be listed in the Flags in this File
}
InTheCloudDan commented 2 months ago

It's supported today! You can read look at this section of the docs https://docs.launchdarkly.com/home/observability/code-references#using-ld-find-code-refs-with-the-react-web-sdk which describes how to setup aliases.

tl;dr

add a .launchdarkly directory in the root of the repo. Then add a coderefs.yaml under it so it looks like .launchdarkly/coderefs.yaml and then in the file:

aliases:
  - type: camelcase

If you have any other feedback on the extension we'd appreciate it.

SevenOutman commented 2 months ago

Hey @InTheCloudDan, thanks for your response! I tried the config and I can see flag info when I hover the specifier now. However the "Flags in this file" section is still empty.

image