Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Copy FunctionNew to Visual Studio Code? Get it now.
Copy Function

Copy Function

mml

|
94 installs
| (2) | Free
Copies the entire function to the clipboard when triggered via context menu or shortcut.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Copy Function Extension / Copiar Função

VS Code Marketplace License: MIT

Esta extensão para o VS Code permite copiar, selecionar ou recortar toda a função (ou método) para facilitar a extração, reutilização ou modificação do código.
This VS Code extension allows you to copy, select, or cut the entire function (or method) to facilitate code extraction, reuse, or modification.

alt text


Descrição / Description

Português:
A extensão Copy Function permite que você copie, selecione ou recorte a função inteira onde o cursor está localizado. As funcionalidades são acionadas pelos comandos disponíveis no menu de contexto do editor ou por atalhos de teclado:

  • Cópia: Ctrl+Shift+C (Mac: Cmd+Shift+C)
  • Seleção: Ctrl+Shift+S (Mac: Cmd+Shift+S)
  • Recorte: Ctrl+Shift+X (Mac: Cmd+Shift+X)

⚠️ Nota sobre atalhos: O atalho Ctrl+Shift+C pode conflitar com o comando nativo "Developer: Toggle DevTools" em algumas configurações. Você pode personalizar os atalhos em Arquivo > Preferências > Atalhos de Teclado.

English:
The Copy Function extension enables you to copy, select, or cut the entire function where the cursor is located. The functionalities are triggered via the context menu command in the editor or by using the following keyboard shortcuts:

  • Copy: Ctrl+Shift+C (Mac: Cmd+Shift+C)
  • Select: Ctrl+Shift+S (Mac: Cmd+Shift+S)
  • Cut: Ctrl+Shift+X (Mac: Cmd+Shift+X)

⚠️ Note about shortcuts: The Ctrl+Shift+C shortcut may conflict with the native "Developer: Toggle DevTools" command in some configurations. You can customize shortcuts in File > Preferences > Keyboard Shortcuts.


Motivo da Criação / Reason for Creation

Português:
Eu frequentemente precisava selecionar, copiar ou recortar a função inteira, tendo que realizar múltiplos cliques e scroll manual para capturar todo o trecho de código. Procurei no Marketplace alguma solução que atendesse exatamente essa necessidade e, ao não encontrar, decidi criar esta extensão. Caso já exista uma maneira mais prática ou nativa de realizar essa tarefa no VS Code, peço desculpas. Se houver qualquer problema, por favor, informe para que eu possa realizar as correções necessárias. O código-fonte está disponível no repositório para contribuições e forks.

English:
I often had to manually select, copy, or cut the entire function, which required multiple clicks and manual scrolling to capture the whole code snippet. I searched the Marketplace for a solution that met this specific need, and when I couldn’t find one, I decided to create this extension. If there is an easier or native way to do this in VS Code, I apologize. If you encounter any issues, please let me know so I can address them. The source code is available in the repository for contributions and forks.


Funcionalidades / Features

  • Cópia de Função:
    Copia o código inteiro da função ou método para o clipboard.
    Function Copy: Copies the entire function or method code to the clipboard.
  • Seleção de Função:
    Seleciona a função inteira no editor, facilitando a análise, modificação ou extração do código.
    Function Selection: Selects the entire function in the editor, making it easier to review, modify, or extract the code.
  • Recorte de Função:
    Recorta (corta) o código inteiro da função ou método para o clipboard e o remove do editor.
    Function Cut: Cuts the entire function or method code to the clipboard and removes it from the editor.
  • Suporte a Internacionalização:
    Mensagens e descrições em inglês e português (pt-BR) utilizando vscode-nls.
    Internationalization Support: Messages and descriptions available in English and Brazilian Portuguese using vscode-nls.
  • Atalho e Menu de Contexto:
    Atalhos de teclado:
    • Ctrl+Shift+C para copiar
    • Ctrl+Shift+S para selecionar
    • Ctrl+Shift+X para recortar
      e comandos no menu de contexto do editor.
      Shortcut and Context Menu: Keyboard shortcuts (as listed above) and commands in the editor context menu.
  • Logs para Depuração:
    Log detalhado no console para auxiliar na depuração e monitoramento da ativação da extensão.
    Debug Logging: Detailed console logging to assist in debugging and monitoring extension activation.

Onde Foi Testado / Where It Was Tested

Português:
Apenas testei a extensão usando C e TypeScript, mas acredito que ela funcione com diversas outras linguagens de programação.

English:
I have only tested the extension using C and TypeScript, but I believe it should work with many other programming languages.


Requisitos / Requirements

  • VS Code: Versão ^1.75.0 ou superior.
    VS Code: Version ^1.75.0 or higher.
  • Node.js: Recomenda-se a versão 18 ou superior.
    Node.js: Node.js version 18 or higher is recommended.
  • TypeScript: Utilizado para o desenvolvimento da extensão.

Instalação / Installation

  1. Clone o repositório:

    git clone https://github.com/mmlo/vscode-copy-function-extension.git
    


Desenvolvimento / Development

Pré-requisitos / Prerequisites

Português:

  • Node.js: Versão 18 ou superior
  • npm: Para gerenciamento de pacotes
  • VS Code: Versão ^1.75.0 ou superior

English:

  • Node.js: Version 18 or higher
  • npm: For package management
  • VS Code: Version ^1.75.0 or higher

Compilação / Build

Português:

  1. Instale as dependências:

    npm install
    
  2. Compile a extensão:

    npm run compile
    

    Este comando irá:

    • Compilar o TypeScript para JavaScript usando webpack
    • Gerar o arquivo out/extension.js otimizado

English:

  1. Install dependencies:

    npm install
    
  2. Compile the extension:

    npm run compile
    

    This command will:

    • Compile TypeScript to JavaScript using webpack
    • Generate the optimized out/extension.js file

Teste Local no VS Code / Local Testing in VS Code

Português:

  1. Abra o projeto no VS Code:

    code .
    
  2. Pressione F5 ou vá em Run > Start Debugging:

    • Isso abrirá uma nova janela do VS Code com a extensão carregada
    • A extensão será ativada automaticamente quando você usar os comandos
  3. Teste os comandos:

    • Abra um arquivo de código (TypeScript, JavaScript, etc.)
    • Escreva uma função
    • Clique com botão direito dentro da função
    • Teste os comandos: "Copy Function", "Select Function", "Cut Function"
    • Teste os atalhos: Ctrl+Shift+C, Ctrl+Shift+S, Ctrl+Shift+X

English:

  1. Open the project in VS Code:

    code .
    
  2. Press F5 or go to Run > Start Debugging:

    • This will open a new VS Code window with the extension loaded
    • The extension will activate automatically when you use the commands
  3. Test the commands:

    • Open a code file (TypeScript, JavaScript, etc.)
    • Write a function
    • Right-click inside the function
    • Test the commands: "Copy Function", "Select Function", "Cut Function"
    • Test the shortcuts: Ctrl+Shift+C, Ctrl+Shift+S, Ctrl+Shift+X

Teste Local no Browser / Local Testing in Browser

Português:

  1. Instale as dependências de teste web:

    npm install -g @vscode/test-web
    
  2. Execute os testes web:

    npx @vscode/test-web --extensionDevelopmentPath=.
    

    Este comando irá:

    • Abrir uma página web no seu navegador padrão
    • Carregar a extensão em um ambiente web simulado
    • Permitir testar a funcionalidade no github.dev/vscode.dev
  3. Teste no browser:

    • Abra um arquivo de código no editor web
    • Use os comandos do menu de contexto
    • Verifique se a extensão funciona corretamente

English:

  1. Install web testing dependencies:

    npm install -g @vscode/test-web
    
  2. Run web tests:

    npx @vscode/test-web --extensionDevelopmentPath=.
    

    This command will:

    • Open a web page in your default browser
    • Load the extension in a simulated web environment
    • Allow testing functionality in github.dev/vscode.dev
  3. Test in browser:

    • Open a code file in the web editor
    • Use context menu commands
    • Verify the extension works correctly

Publicação no Marketplace / Publishing to Marketplace

Português:

  1. Instale o VSCE (VS Code Extension Manager):

    npm install -g @vscode/vsce
    
  2. Faça login no marketplace (opcional, se não estiver logado):

    vsce login <publisher-name>
    

    Nota: Você precisa de uma conta no Azure DevOps ou GitHub para publicar.

  3. Crie o pacote da extensão:

    vsce package
    

    Este comando irá:

    • Criar um arquivo .vsix (ex: copy-function-extension-0.0.8.vsix)
    • O arquivo será otimizado usando o .vscodeignore
  4. Teste o pacote localmente (opcional):

    code --install-extension copy-function-extension-0.0.8.vsix
    
  5. Publique no marketplace:

    vsce publish
    

    Ou para publicar uma versão específica:

    vsce publish <version>
    
  6. Verifique a publicação:

    • Vá para VS Code Marketplace
    • Procure pela sua extensão
    • Teste a instalação

English:

  1. Install VSCE (VS Code Extension Manager):

    npm install -g @vscode/vsce
    
  2. Login to marketplace (optional, if not logged in):

    vsce login <publisher-name>
    

    Note: You need an Azure DevOps or GitHub account to publish.

  3. Create the extension package:

    vsce package
    

    This command will:

    • Create a .vsix file (e.g., copy-function-extension-0.0.8.vsix)
    • The file will be optimized using .vscodeignore
  4. Test the package locally (optional):

    code --install-extension copy-function-extension-0.0.8.vsix
    
  5. Publish to marketplace:

    vsce publish
    

    Or to publish a specific version:

    vsce publish <version>
    
  6. Verify publication:

    • Go to VS Code Marketplace
    • Search for your extension
    • Test the installation

Scripts Disponíveis / Available Scripts

Português:

{
  "scripts": {
    "vscode:prepublish": "npm run compile",
    "compile": "webpack --mode production",
    "test": "npm run lint && npm run unit-test",
    "lint": "eslint . --ext .ts",
    "unit-test": "mocha ./out/test/**/*.test.js",
    "webpack": "webpack --mode development"
  }
}
  • npm run compile - Compila a extensão para produção
  • npm run webpack - Compila em modo desenvolvimento
  • npm test - Executa linting e testes unitários
  • npm run lint - Executa apenas o linting

English:

{
  "scripts": {
    "vscode:prepublish": "npm run compile",
    "compile": "webpack --mode production",
    "test": "npm run lint && npm run unit-test",
    "lint": "eslint . --ext .ts",
    "unit-test": "mocha ./out/test/**/*.test.js",
    "webpack": "webpack --mode development"
  }
}
  • npm run compile - Compiles the extension for production
  • npm run webpack - Compiles in development mode
  • npm test - Runs linting and unit tests
  • npm run lint - Runs only linting

Contribuição / Contributing

Português:

  1. Fork o projeto
  2. Crie uma branch para sua feature (git checkout -b feature/AmazingFeature)
  3. Commit suas mudanças (git commit -m 'Add some AmazingFeature')
  4. Push para a branch (git push origin feature/AmazingFeature)
  5. Abra um Pull Request

English:

  1. Fork the project
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Licença / License

Português:
Este projeto está sob a licença MIT - veja o arquivo LICENSE.md para detalhes.

English:
This project is licensed under the MIT License - see the LICENSE.md file for details.


Suporte / Support

Português:
Se você encontrar algum problema ou tiver sugestões:

  • Abra uma issue no GitHub
  • Verifique os logs no Developer Console (F12) para mensagens de erro
  • Certifique-se de que está usando uma linguagem suportada

English:
If you encounter any issues or have suggestions:

  • Open an issue on GitHub
  • Check the logs in Developer Console (F12) for error messages
  • Make sure you are using a supported language

Última atualização: Outubro 2025

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft