1
0
mirror of synced 2025-12-21 19:06:49 -05:00

Move Copilot variables from product.yml to copilot.yml (#55832)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: hubwriter <54933897+hubwriter@users.noreply.github.com>
Co-authored-by: hubwriter <hubwriter@github.com>
Co-authored-by: felicitymay <1877141+felicitymay@users.noreply.github.com>
Co-authored-by: Felix Guntrip <stevecat@github.com>
Co-authored-by: Joe Clark <31087804+jc-clark@users.noreply.github.com>
Co-authored-by: Ebonsignori <17055832+Ebonsignori@users.noreply.github.com>
This commit is contained in:
Copilot
2025-06-02 11:35:54 +01:00
committed by GitHub
parent 82ad892a34
commit ec7bb4d9bb
347 changed files with 1868 additions and 1863 deletions

View File

@@ -1,7 +1,7 @@
---
title: Decoupling business logic from UI components
shortTitle: Decoupling business logic
intro: '{% data variables.product.prodname_copilot_chat_short %} can help you separate your business logic from your user interface code, making it easier to maintain and scale your application.'
intro: '{% data variables.copilot.copilot_chat_short %} can help you separate your business logic from your user interface code, making it easier to maintain and scale your application.'
redirect_from:
- /copilot/example-prompts-for-github-copilot-chat/refactoring-code/decoupling-business-logic-from-ui-components
versions:
@@ -17,7 +17,7 @@ topics:
In many front-end frameworks, business logic can become embedded within user interface (UI) components, making the code hard to maintain or extend, especially as the application grows.
{% data variables.product.prodname_copilot_chat_short %} can help you refactor your code to extract business logic into separate services or state management solutions. This allows the business logic to be reused across different UI components. It also makes the code easier to scale by separating concerns and reducing interdependencies, and it simplifies unit testing by allowing business logic to be tested independently from UI components.
{% data variables.copilot.copilot_chat_short %} can help you refactor your code to extract business logic into separate services or state management solutions. This allows the business logic to be reused across different UI components. It also makes the code easier to scale by separating concerns and reducing interdependencies, and it simplifies unit testing by allowing business logic to be tested independently from UI components.
## Example scenario
@@ -60,7 +60,7 @@ The suggested changes refactor the `Counter` component to use Redux for state ma
The proposed changes separate the code into five separate files.
> [!NOTE] {% data variables.product.prodname_copilot_chat_short %} responses are non-deterministic, so you may get a different response from the one described here.
> [!NOTE] {% data variables.copilot.copilot_chat_short %} responses are non-deterministic, so you may get a different response from the one described here.
### actions.js

View File

@@ -1,7 +1,7 @@
---
title: 'Fixing database deadlocks or data integrity issues'
shortTitle: Fix database deadlocks
intro: '{% data variables.product.prodname_copilot_chat_short %} can help you avoid code that causes slow or blocked database operations, or tables with missing or incorrect data.'
intro: '{% data variables.copilot.copilot_chat_short %} can help you avoid code that causes slow or blocked database operations, or tables with missing or incorrect data.'
redirect_from:
- /copilot/example-prompts-for-github-copilot-chat/refactoring-code/fixing-database-deadlocks-or-data-integrity-issues
versions:
@@ -17,9 +17,9 @@ topics:
Complex database operationsparticularly those involving transactionscan lead to deadlocks or data inconsistencies that are hard to debug.
{% data variables.product.prodname_copilot_chat_short %} can help by identifying points in a transaction where locking or deadlocks could occur, and can suggest best practices for transaction isolation or deadlock resolution, such as adjusting locking strategies or handling deadlock exceptions gracefully.
{% data variables.copilot.copilot_chat_short %} can help by identifying points in a transaction where locking or deadlocks could occur, and can suggest best practices for transaction isolation or deadlock resolution, such as adjusting locking strategies or handling deadlock exceptions gracefully.
> [!NOTE] The responses shown in this article are examples. {% data variables.product.prodname_copilot_chat_short %} responses are non-deterministic, so you may get different responses from the ones shown here.
> [!NOTE] The responses shown in this article are examples. {% data variables.copilot.copilot_chat_short %} responses are non-deterministic, so you may get different responses from the ones shown here.
## Avoiding simultaneous updates on interdependent rows
@@ -42,7 +42,7 @@ COMMIT TRANSACTION;
You can check whether there are any problems with this transaction.
In the editor, select the transaction code, then ask {% data variables.product.prodname_copilot_chat_short %}:
In the editor, select the transaction code, then ask {% data variables.copilot.copilot_chat_short %}:
`Is this transaction good?`

View File

@@ -1,7 +1,7 @@
---
title: Fixing lint errors
shortTitle: Lint errors
intro: '{% data variables.product.prodname_copilot_chat_short %} can suggest ways to fix issues identified by a code linter.'
intro: '{% data variables.copilot.copilot_chat_short %} can suggest ways to fix issues identified by a code linter.'
redirect_from:
- /copilot/example-prompts-for-github-copilot-chat/refactoring-code/fixing-lint-errors
versions:
@@ -19,7 +19,7 @@ It's good practice to use a linter to check your code for potential errors, styl
## Example scenario
You have run a linter on your code and it has identified some issues that need to be fixed. Rather than fixing these manually, you can ask {% data variables.product.prodname_copilot_chat_short %} to fix them for you.
You have run a linter on your code and it has identified some issues that need to be fixed. Rather than fixing these manually, you can ask {% data variables.copilot.copilot_chat_short %} to fix them for you.
## Example prompts
@@ -35,7 +35,7 @@ You have run a linter on your code and it has identified some issues that need t
`Use the attached style guide to fix the lint errors`
* Alternatively, you can ask {% data variables.product.prodname_copilot_chat_short %} to fix only a specific type of lint error:
* Alternatively, you can ask {% data variables.copilot.copilot_chat_short %} to fix only a specific type of lint error:
`Make sure all functions use snake_case naming style`

View File

@@ -1,7 +1,7 @@
---
title: Handling cross-cutting concerns
shortTitle: Cross-cutting concerns
intro: '{% data variables.product.prodname_copilot_chat_short %} can help you avoid code that relates to a concern other than the core concern of the method or function in which the code is located.'
intro: '{% data variables.copilot.copilot_chat_short %} can help you avoid code that relates to a concern other than the core concern of the method or function in which the code is located.'
redirect_from:
- /copilot/example-prompts-for-github-copilot-chat/refactoring-code/handling-cross-cutting-concerns
versions:
@@ -17,7 +17,7 @@ topics:
Cross-cutting concerns are aspects of a program that affect multiple parts of the system, such as logging, security, data validation, and error handling. They can become scattered throughout a codebase, leading to code duplication and maintenance challenges.
{% data variables.product.prodname_copilot_chat_short %} can help refactor cross-cutting concerns by suggesting the implementation of Aspect-Oriented Programming (AOP) practices or using decorators and middleware patterns to centralize these concerns in a modular, maintainable way.
{% data variables.copilot.copilot_chat_short %} can help refactor cross-cutting concerns by suggesting the implementation of Aspect-Oriented Programming (AOP) practices or using decorators and middleware patterns to centralize these concerns in a modular, maintainable way.
## Example scenario
@@ -89,7 +89,7 @@ class OrderService:
## Example prompt
Open the project workspace in {% data variables.product.prodname_vscode_shortname %} or {% data variables.product.prodname_vs %} and enter the following prompt in the {% data variables.product.prodname_copilot_chat_short %} view.
Open the project workspace in {% data variables.product.prodname_vscode_shortname %} or {% data variables.product.prodname_vs %} and enter the following prompt in the {% data variables.copilot.copilot_chat_short %} view.
`@workspace Refactor this project by using AOP to avoid logging that has cross-cutting concerns`

View File

@@ -1,7 +1,7 @@
---
title: 'Improving code readability and maintainability'
shortTitle: Improve code readability
intro: '{% data variables.product.prodname_copilot_chat_short %} can suggest ways to make your code easier to understand and maintain.'
intro: '{% data variables.copilot.copilot_chat_short %} can suggest ways to make your code easier to understand and maintain.'
redirect_from:
- /copilot/example-prompts-for-github-copilot-chat/refactoring-code/improving-code-readability-and-maintainability
versions:
@@ -15,15 +15,15 @@ topics:
- Copilot
---
Code with poor readability is difficult for other developers to maintain and extend. {% data variables.product.prodname_copilot_chat_short %} can help in a number of ways. For example, by:
Code with poor readability is difficult for other developers to maintain and extend. {% data variables.copilot.copilot_chat_short %} can help in a number of ways. For example, by:
* [Suggesting improvements to variable names](#improving-variable-names)
* [Avoiding sequential conditional checks](#avoiding-sequential-conditional-checks)
* [Reducing nested logic](#reducing-nested-logic)
* [Splitting large methods into smaller, more readable ones](#splitting-up-large-methods)
Documenting your code is another way to improve the maintainability of your code. For information about using {% data variables.product.prodname_copilot_chat_short %} to help you add useful comments to your code, see the example prompts in [Documenting code](/copilot/copilot-chat-cookbook/documenting-code).
Documenting your code is another way to improve the maintainability of your code. For information about using {% data variables.copilot.copilot_chat_short %} to help you add useful comments to your code, see the example prompts in [Documenting code](/copilot/copilot-chat-cookbook/documenting-code).
> [!NOTE] The responses shown in this article are examples. {% data variables.product.prodname_copilot_chat_short %} responses are non-deterministic, so you may get different responses from the ones shown here.
> [!NOTE] The responses shown in this article are examples. {% data variables.copilot.copilot_chat_short %} responses are non-deterministic, so you may get different responses from the ones shown here.
## Improving variable names
@@ -45,7 +45,7 @@ function logPersonsAge(a, b, c) {
### Example prompt
In the editor, select the function you want to change, then ask {% data variables.product.prodname_copilot_chat_short %}:
In the editor, select the function you want to change, then ask {% data variables.copilot.copilot_chat_short %}:
`Improve the variable names in this function`

View File

@@ -1,7 +1,7 @@
---
title: Refactoring data access layers
shortTitle: Data access layers
intro: '{% data variables.product.prodname_copilot_chat_short %} can suggest ways to decouple your data access code from your business logic, making an application easier to maintain and scale.'
intro: '{% data variables.copilot.copilot_chat_short %} can suggest ways to decouple your data access code from your business logic, making an application easier to maintain and scale.'
redirect_from:
- /copilot/example-prompts-for-github-copilot-chat/refactoring-code/refactoring-data-access-layers
versions:
@@ -17,9 +17,9 @@ topics:
Hardcoded SQL queries and tightly coupled data access code can make it difficult to scale or switch databases, and they often lead to repeated logic.
{% data variables.product.prodname_copilot_chat_short %} can recommend implementing a repository pattern or data access layer that abstracts database interactions, making the code more modular and reducing redundancy. It can also help refactor SQL queries into optimized versions, improving performance and maintainability.
{% data variables.copilot.copilot_chat_short %} can recommend implementing a repository pattern or data access layer that abstracts database interactions, making the code more modular and reducing redundancy. It can also help refactor SQL queries into optimized versions, improving performance and maintainability.
> [!NOTE] The responses described in this article are examples. {% data variables.product.prodname_copilot_chat_short %} responses are non-deterministic, so you may get different responses from the ones shown here.
> [!NOTE] The responses described in this article are examples. {% data variables.copilot.copilot_chat_short %} responses are non-deterministic, so you may get different responses from the ones shown here.
## Example scenario

View File

@@ -1,7 +1,7 @@
---
title: Refactoring for performance optimization
shortTitle: Performance optimization
intro: '{% data variables.product.prodname_copilot_chat_short %} can suggest ways to speed up slow-running code.'
intro: '{% data variables.copilot.copilot_chat_short %} can suggest ways to speed up slow-running code.'
redirect_from:
- /copilot/example-prompts-for-github-copilot-chat/refactoring-code/refactoring-for-performance-optimization
versions:
@@ -17,7 +17,7 @@ topics:
Existing code may function correctly but be inefficient, leading to performance bottlenecks. Examples of coding that can adversely impact performance include inefficient loops, unnecessary computations, and excessive memory allocation.
{% data variables.product.prodname_copilot_chat_short %} can identify performance hotspots and suggest refactoring strategies such as optimizing data structures (for example, using hashmaps instead of arrays), reducing redundant calculations, and improving algorithmic efficiency. It can also recommend caching mechanisms or parallelizing operations to improve performance.
{% data variables.copilot.copilot_chat_short %} can identify performance hotspots and suggest refactoring strategies such as optimizing data structures (for example, using hashmaps instead of arrays), reducing redundant calculations, and improving algorithmic efficiency. It can also recommend caching mechanisms or parallelizing operations to improve performance.
## Example scenario
@@ -61,7 +61,7 @@ if __name__ == "__main__":
{% data variables.product.prodname_copilot_short %} suggests using a sieve function to generate the prime numbers much more efficiently. If you run this program it will complete in a fraction of a second.
> [!NOTE] {% data variables.product.prodname_copilot_chat_short %} responses are non-deterministic, so you may get a different response from the one shown here.
> [!NOTE] {% data variables.copilot.copilot_chat_short %} responses are non-deterministic, so you may get a different response from the one shown here.
```python
import time

View File

@@ -1,7 +1,7 @@
---
title: Refactoring to implement a design pattern
shortTitle: Design patterns
intro: '{% data variables.product.prodname_copilot_chat_short %} can suggest design patterns that you can use to improve your code.'
intro: '{% data variables.copilot.copilot_chat_short %} can suggest design patterns that you can use to improve your code.'
redirect_from:
- /copilot/example-prompts-for-github-copilot-chat/refactoring-code/refactoring-to-implement-a-design-pattern
versions:
@@ -17,9 +17,9 @@ topics:
Code that doesnt follow established design patterns (like Singleton, Factory, or Observer) can lead to issues like tight coupling, lack of flexibility, or duplicated code.
{% data variables.product.prodname_copilot_chat_short %} can help you use appropriate design patterns to make your code more flexible and maintainable. For example, it can recommend converting repetitive instantiations into a Factory pattern, or using the Observer pattern to decouple tightly connected classes.
{% data variables.copilot.copilot_chat_short %} can help you use appropriate design patterns to make your code more flexible and maintainable. For example, it can recommend converting repetitive instantiations into a Factory pattern, or using the Observer pattern to decouple tightly connected classes.
> [!NOTE] The responses described in this article are examples. {% data variables.product.prodname_copilot_chat_short %} responses are non-deterministic, so you may get different responses from the ones shown here.
> [!NOTE] The responses described in this article are examples. {% data variables.copilot.copilot_chat_short %} responses are non-deterministic, so you may get different responses from the ones shown here.
## Example scenario

View File

@@ -1,7 +1,7 @@
---
title: Simplifying complex inheritance hierarchies
shortTitle: Simplify inheritance hierarchies
intro: '{% data variables.product.prodname_copilot_chat_short %} can help you to refactor code to avoid classes with multiple layers of inheritance.'
intro: '{% data variables.copilot.copilot_chat_short %} can help you to refactor code to avoid classes with multiple layers of inheritance.'
redirect_from:
- /copilot/example-prompts-for-github-copilot-chat/refactoring-code/simplifying-complex-inheritance-hierarchies
versions:
@@ -17,7 +17,7 @@ topics:
Deep inheritance hierarchies, or improper use of inheritance, can lead to code that is hard to maintain, making it difficult to follow relationships between classes, or to extend them without causing breakage.
{% data variables.product.prodname_copilot_chat_short %} can suggest refactoring inheritance-based designs into more flexible composition-based designs (favoring composition over inheritance). It can also recommend applying patterns like Strategy or Decorator to make the system more extensible without adding complexity to the inheritance structure.
{% data variables.copilot.copilot_chat_short %} can suggest refactoring inheritance-based designs into more flexible composition-based designs (favoring composition over inheritance). It can also recommend applying patterns like Strategy or Decorator to make the system more extensible without adding complexity to the inheritance structure.
## Example scenario

View File

@@ -1,7 +1,7 @@
---
title: Translating code to a different programming language
shortTitle: Translate code
intro: '{% data variables.product.prodname_copilot_chat_short %} can help you rewrite code to perform the same operations but in a different programming language.'
intro: '{% data variables.copilot.copilot_chat_short %} can help you rewrite code to perform the same operations but in a different programming language.'
versions:
feature: copilot
category:
@@ -75,7 +75,7 @@ print "The file '$file_path' contains $word_count words and $char_count characte
{% data variables.product.prodname_copilot_short %} generates the following Typescript code.
> [!NOTE] {% data variables.product.prodname_copilot_chat_short %} responses are non-deterministic, so you may get a different response from the one shown here.
> [!NOTE] {% data variables.copilot.copilot_chat_short %} responses are non-deterministic, so you may get a different response from the one shown here.
```typescript copy
import * as fs from 'fs';