Skip to content

refactor: trim comments in the inline-script quick fix - #1789

Closed
Stella Huang (StellaHuang95) wants to merge 1 commit into
microsoft:mainfrom
StellaHuang95:stellahuang-microsoft-inline-script-code-action
Closed

Stella Huang (StellaHuang95) wants to merge 1 commit into
microsoft:mainfrom
StellaHuang95:stellahuang-microsoft-inline-script-code-action

Conversation

@StellaHuang95

Copy link
Copy Markdown
Contributor

Follow-up to #1788 (merged). That PR's comments were heavier than they needed to be; this trims them down to the handful that carry information the code does not.

No behavior change. Only comments and JSDoc are touched — 33 comment lines removed, 8 added back in condensed form, for a net reduction of 25.

What is kept, and why

Three comments survive because each documents a decision a reviewer would otherwise read as a bug:

  • reportMissingModuleSource is in the unresolved-import code set. Pylance's own isMissingImportDiagnostic() excludes it, because for their change-spelling fix a stub-resolved module is correctly spelled. For us, "stub found but no source" means the package is not installed, which setting the environment up fixes. Reduced from a 6-line block to a trailing comment on the line itself.
  • The routing metadata is reseeded after the save. Without it, a just-typed # /// script block gains its identity mid-create, which setUpInlineScriptEnvironment reads as a concurrent edit and silently skips the association. Reduced 3 lines to 2.
  • promptUpdateExtensionsForInlineScripts() sits outside the try. The environment is already set up by that point, so a failure in the follow-up must not be surfaced to the user as a setup failure. Reduced 2 lines to 1.

The class-level JSDoc on InlineScriptSetupCodeActionProvider is kept at 3 lines — it still records that diagnostics and isPreferred are deliberately unset, which is the non-obvious part of the design.

What is removed

  • The 6-line JSDoc over UNRESOLVED_IMPORT_DIAGNOSTIC_CODES.
  • The 4-line JSDoc on isUnresolvedImportDiagnostic, condensed to one line.
  • The 10-line class JSDoc, condensed to three.
  • The provideCodeActions gating-order comment — the gate order is legible from the code.
  • JSDoc on the two private helpers findOpenDocument and saveScriptBeforeSetup. The repo convention asks for docstrings on public functions; these are module-private.

Every exported symbol still carries a docstring, per .github/copilot-instructions.md.

Validation

  • npm run lint — clean
  • npm run compile-tests — clean
  • npm run unittest — 2323 passing, 6 pending, 0 failing (unchanged from baseline)

The feature remains behind python-envs.inlineScripts.enabled, so nothing here is user-visible.

Condenses the comments added in microsoft#1788 down to what is not obvious from the
code: the deliberate inclusion of reportMissingModuleSource, the reason the
routing metadata is reseeded after a save, and the reason the companion
extension version check sits outside the try block.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@StellaHuang95

Copy link
Copy Markdown
Contributor Author

Closing for now - not ready to review yet.

@StellaHuang95
Stella Huang (StellaHuang95) deleted the stellahuang-microsoft-inline-script-code-action branch September 16, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant