Skip to content

Commit

Permalink
feat(copyVariableName): allow to copy first destructured or imported …
Browse files Browse the repository at this point in the history
…variable (#9)
  • Loading branch information
zardoy committed Jun 20, 2022
1 parent 49dc356 commit 5129667
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/features/copyVariableName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const registerCopyVariableName = () => {
// also would make sense to support mutliple selections/cursors
let varName: string | undefined
const lineText = activeEditor.document.lineAt(activeEditor.selection.end).text
const constName = /\s*(?:const|let|type|interface|import) ([\w\d]+)/.exec(lineText)?.[1]
const constName = /\s*(?:const(?: {)?|let(?: {)?|type|interface|import(?: {)?) ([\w\d]+)/.exec(lineText)?.[1]
varName = constName
if (!varName) {
// TODO replaceDocumentation?: (str
Expand Down

0 comments on commit 5129667

Please sign in to comment.