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

Implement default problem matcher and task for running Python files. #23953

Closed
wants to merge 43 commits into from

Conversation

anthonykim1
Copy link

@anthonykim1 anthonykim1 commented Aug 16, 2024

Resolves: #3828

TODO: Check and compare different outputs among Python3.8~3.13.

  • Make sure errors, outputs are covered across versions that Python extension support.

TODO: Dynamically get user's current Python file instead of hard-coded dummy file.

  • Basically simulate Run File in Terminal but for Task with Problem Matcher.

@anthonykim1 anthonykim1 added feature-request Request for new features or functionality area-terminal area-editor-* User-facing catch-all labels Aug 16, 2024
@anthonykim1 anthonykim1 added this to the August 2024 milestone Aug 16, 2024
@anthonykim1 anthonykim1 self-assigned this Aug 16, 2024
package.json Outdated
@@ -73,12 +73,55 @@
"workspaceContains:manage.py",
"workspaceContains:app.py",
"workspaceContains:.venv",
"workspaceContains:.conda"
"workspaceContains:.conda",
"onCommand:workbench.action.tasks.runTask"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't recommend doing this.

],
"main": "./out/client/extension",
"browser": "./dist/extension.browser.js",
"l10n": "./l10n",
"contributes": {
"taskDefinitions": [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need task definitions?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This essentially allow us to contribute a task as an extension to core, this is so our contributed Task shows up when user goes to 'Run Task'
Screenshot 2024-08-16 at 3 12 25 PM
Screenshot 2024-08-16 at 3 12 22 PM

@anthonykim1
Copy link
Author

anthonykim1 commented Aug 21, 2024

Blocked on microsoft/vscode#225826
Talked to @meganrogge and I think we found a bug. ---> Resolved

anthonykim1 and others added 22 commits September 13, 2024 16:16
In addition to first PR
microsoft#23937

I've been able to repro aggressive errors of 
```
2024-08-12 13:59:21.087 [error] [Error: spawn pixi ENOENT
	at ChildProcess._handle.onexit (node:internal/child_process:286:19)
	at onErrorNT (node:internal/child_process:484:16)
	at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn pixi',
  path: 'pixi',
  spawnargs: [ '--version' ]
}
```

```
2024-08-12 13:59:20.794 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir '/Users/anthonykim/Desktop/vscode-python/.pixi/envs'
	at Object.readdirSync (node:fs:1509:26)
	at t.readdirSync (node:electron/js2c/node_init:2:11418)
	at /Users/anthonykim/.vscode/extensions/ms-python.python-2024.13.2024080901-darwin-arm64/out/client/extension.js:2:583006
	at /Users/anthonykim/.vscode/extensions/ms-python.python-2024.13.2024080901-darwin-arm64/out/client/extension.js:2:583197
	at Array.map (<anonymous>)
	at d.initWatchers (/Users/anthonykim/.vscode/extensions/ms-python.python-2024.13.2024080901-darwin-arm64/out/client/extension.js:2:582915)
	at async d.ensureWatchersReady (/Users/anthonykim/.vscode/extensions/ms-python.python-2024.13.2024080901-darwin-arm64/out/client/extension.js:2:539326)] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '/Users/anthonykim/Desktop/vscode-python/.pixi/envs'
}
```

even when I dont have pixi in my workspace. Changing the log level on
this and adding more wraps around that should give necessary
hint/message when needed without crashing program.

---------

Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
Resolves: microsoft#23743

It seems that when people have a multi line string such surrounded by
""" quotes, the white spacing inside the quote is very much intentional,
and so if we detect that they are in such code-block, we would rather
not normalize/truncate the white spaces for that specific code block.
This is to match the latest updates we've made in pylance.

See this PR:
microsoft/pyrx#5590
Bumps [importlib-metadata](https://github.com/python/importlib_metadata)
from 8.1.0 to 8.4.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/python/importlib_metadata/blob/main/NEWS.rst">importlib-metadata's
changelog</a>.</em></p>
<blockquote>
<h1>v8.4.0</h1>
<h2>Features</h2>
<ul>
<li>Deferred import of inspect for import performance. (<a
href="https://redirect.github.com/python/importlib_metadata/issues/499">#499</a>)</li>
</ul>
<h1>v8.3.0</h1>
<h2>Features</h2>
<ul>
<li>Disallow passing of 'dist' to EntryPoints.select.</li>
</ul>
<h1>v8.2.0</h1>
<h2>Features</h2>
<ul>
<li>Add SimplePath to importlib_metadata.<strong>all</strong>. (<a
href="https://redirect.github.com/python/importlib_metadata/issues/494">#494</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/python/importlib_metadata/commit/1616cb3a82c33c3603ff984b6ff417e68068aa6e"><code>1616cb3</code></a>
Finalize</li>
<li><a
href="https://github.com/python/importlib_metadata/commit/71b467843258873048eb944545ba1235866523e6"><code>71b4678</code></a>
Add news fragment.</li>
<li><a
href="https://github.com/python/importlib_metadata/commit/ebcdcfdd18d427498f11b74e245b3f8a7ef5df9c"><code>ebcdcfd</code></a>
Remove workaround for <a
href="https://redirect.github.com/python/typeshed/issues/10328">python/typeshed#10328</a>.</li>
<li><a
href="https://github.com/python/importlib_metadata/commit/2c43cfe7dba2902095a166c4f6226ac5f7bfb50b"><code>2c43cfe</code></a>
Merge pull request <a
href="https://redirect.github.com/python/importlib_metadata/issues/499">#499</a>
from danielhollas/defer-inspect</li>
<li><a
href="https://github.com/python/importlib_metadata/commit/a7aaf72702b3a49ea3e33c9cf7f223839067c883"><code>a7aaf72</code></a>
Use third-person imperative voice and link to issue in comment.</li>
<li><a
href="https://github.com/python/importlib_metadata/commit/e99c10510d48e840b0550bd05d1167633dcfaea7"><code>e99c105</code></a>
Restore single-expression logic.</li>
<li><a
href="https://github.com/python/importlib_metadata/commit/debb5165a88b1a4433150b265e155c21b497d154"><code>debb516</code></a>
Don't use global var</li>
<li><a
href="https://github.com/python/importlib_metadata/commit/3c8e1ec4e34c11dcff086be7fbd0d1981bf32480"><code>3c8e1ec</code></a>
Finalize</li>
<li><a
href="https://github.com/python/importlib_metadata/commit/5035755aac64a6ee902add3909f463a2bf54ee1c"><code>5035755</code></a>
Merge pull request <a
href="https://redirect.github.com/python/importlib_metadata/issues/498">#498</a>
from python/feature/entry-points-disallow-dist-match</li>
<li><a
href="https://github.com/python/importlib_metadata/commit/6d9b766099dbac1c97a220badde7e14304e03291"><code>6d9b766</code></a>
Remove MetadataPathFinder regardless of its position.</li>
<li>Additional commits viewable in <a
href="https://github.com/python/importlib_metadata/compare/v8.1.0...v8.4.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=importlib-metadata&package-manager=pip&previous-version=8.1.0&new-version=8.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.4 to
6.5.7.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/indutny/elliptic/commit/3e46a48fdd2ef2f89593e5e058d85530578c9761"><code>3e46a48</code></a>
6.5.7</li>
<li><a
href="https://github.com/indutny/elliptic/commit/accb61e9c1a005e5c8ff96a8b33893100bb42d11"><code>accb61e</code></a>
lib: DER signature decoding correction</li>
<li><a
href="https://github.com/indutny/elliptic/commit/03e06e135c8e44a2da560fa197d0ba1e1e2759e9"><code>03e06e1</code></a>
6.5.6</li>
<li><a
href="https://github.com/indutny/elliptic/commit/7ac5360118f74eb02da73bdf9f24fd0c72ff5281"><code>7ac5360</code></a>
Merge commit from fork</li>
<li><a
href="https://github.com/indutny/elliptic/commit/75700785ff41bb5d029d19186beff26d4883caa5"><code>7570078</code></a>
6.5.5</li>
<li><a
href="https://github.com/indutny/elliptic/commit/206da2ee373e68466cde353f81fb59ef251b740b"><code>206da2e</code></a>
lib: lint</li>
<li><a
href="https://github.com/indutny/elliptic/commit/0a78e0399ee1f5d919be6aa66b427c67a9df330d"><code>0a78e03</code></a>
[Fix] restore node &lt; 4 compat</li>
<li>See full diff in <a
href="https://github.com/indutny/elliptic/compare/v6.5.4...v6.5.7">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=elliptic&package-manager=npm_and_yarn&previous-version=6.5.4&new-version=6.5.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/microsoft/vscode-python/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
first step in work on
microsoft#23279

---------

Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
…24096)

Reverts microsoft#23977

Have to revert microsoft#23977
with issue: microsoft#23743 due
to microsoft#24069

Will revisit why microsoft#23743
is breaking if contained inside other top level (in ast term) code
block, and look into how to support
microsoft#23743 without
breaking.
Resolves: microsoft#23929 

TODO: (debt --> in separate PR) Have ensureTerminal return
Promise<Terminal> instead of Promise<void> and saving this in the
TerminalService class. Would avoid many uses of the !, and maybe even
get to throw away the TerminalService class itself.
Addresses microsoft#24068

- Enable proposed APIs for `codeActionAI`
- Pin the engine to `1.94.0-20240913`
anthonykim1 added a commit that referenced this pull request Sep 17, 2024
Resolves: #3828
Breaking #23953 down into
two PR
1. problem matcher --> make sure to cover case where there is invalid
strings printed before the Error (e.g. NameError or ValueError)
2. Whether we will replace 'Run In Terminal by contributing task with
the problem matcher attached.

---------

Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-editor-* User-facing catch-all area-terminal feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default Python Problem Matcher
8 participants