Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open but not in active active editor still get scanned? #4

Open
1 task
owzim opened this issue Mar 18, 2024 · 4 comments
Open
1 task

Open but not in active active editor still get scanned? #4

owzim opened this issue Mar 18, 2024 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@owzim
Copy link

owzim commented Mar 18, 2024

I want to make sure I understand this missing feature correctly

  • Add option to take into account files that are open, but not in active editor.

So copilot can still access the content of files, which are open, but not active?

@mathieumagalhaes
Copy link
Owner

mathieumagalhaes commented Mar 18, 2024

Currently, the extension is based on the active editor. For example:

  • Let's say you block *.json files.
  • You open a JSON file, and you'll see Copilot being disabled.
  • You open a second file, not JSON, and this extension will re-enable Copilot. (Even though a JSON file is open in an inactive tab)

I'm not 100% sure if Copilot reads inactive editors, but I've added that as a TODO item, as I would like this extension to be based on all open files as an opt-in configuration. In the case of the example above, Copilot would stay disabled.

If you have any insight if Copilot is or isn't reading inactive editors/tabs, please point me toward a resource which makes this clear.

Also, be aware that this is not an official extension from GitHub. A better solution would be to upvote and advocate for this to be integrated into the original Copilot extension through https://github.com/orgs/community/discussions/10305.

@mathieumagalhaes mathieumagalhaes added the question Further information is requested label Mar 18, 2024
@owzim
Copy link
Author

owzim commented Mar 18, 2024

It does definitely do that. I have a config.php, which is ignored and like expected copilot gets disabled, when I open it. it has a key some.very.random.key in it. when I type $config in another file, copilot suggests $config['some.very.random.key']. When I close that config file, it will no longer be suggested.

@owzim
Copy link
Author

owzim commented Mar 18, 2024

some basic setup to reproduce:

.copilotignore

**/config.*

config.php

<?php

return [
    'some.very.random.key' => true,
];

index.php

<?php

// type $config here to see the suggestions

workspace.code-workspace

{
    "folders": [
        {
            "path": "./"
        }
    ]
}

@mathieumagalhaes
Copy link
Owner

mathieumagalhaes commented Mar 18, 2024

It does definitely do that. I have a config.php, which is ignored and like expected copilot gets disabled, when I open it. it has a key some.very.random.key in it. when I type $config in another file, copilot suggests $config['some.very.random.key']. When I close that config file, it will no longer be suggested.

Seems reasonable to assume Copilot indeed reads background files.
I do not have time to implement this in the comming week.
I'm willing to review any pull request if you are up to it though.

@mathieumagalhaes mathieumagalhaes added enhancement New feature or request good first issue Good for newcomers and removed question Further information is requested labels Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants