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

Unable to debug extension #41

Open
RossBoylan opened this issue Dec 15, 2024 · 0 comments
Open

Unable to debug extension #41

RossBoylan opened this issue Dec 15, 2024 · 0 comments

Comments

@RossBoylan
Copy link
Contributor

Following the steps in CONTRIBUTING.md produces some complaints, and hitting F5 in VScode with extension.js active launches an Extension Development Host. But there is no sign the extension is active in that host.

Extension Not Active in Development Host

Indicated by all the following:

  • the command menu has no literate commands
  • there is no fragment explorer in the left hand pane, even if a .literate file is selected in the editor.
  • a breakpoint on the first line of activate() in extension.js never fires. In fact, it changes from a red dot to a white circle with a dark center. Hovering over it shows "Unbound breakpoint. Some of your breakpoints could not be set. If you're having an issue you can troubleshoot your launch configuration."

May be indicated by the following, or this may be how debugging an extension works:

  • Extension Host output does not mention the extension; it mentions many others.
  • The Extensions view in the Extension Host shows the extension greyed out and disabled (which is its global state).
  • That same view shows the extension version as being the regular one, not the version with my changes.
  • Selecting Show Running Extensions from the top right of the Extensions view produces a list that does not include literate.

Problems with Preliminary Setup

In summary:

  1. No license field.
  2. The engine "vscode" appears to be invalid.
  3. eslint Invalid option '--ext'
  4. Something, probably the eslint problem, cause the pretest to fail with exit code 2.
  5. Despite which out\main.js is getting built
  6. Although it's not visible in the transcript below, extension.js is also getting built.

The documentation (there are pointers to it in the transcript) indicates that --ext stopped working relatively recently; my reading is that it still works provided there is not an eslint.config.js file. Although I can't find one around the project, the module itself does have literate\node_modules\@vscode\test-electron\eslint.config.mjs, which I guess is close enough to disallow the command line use. Since the config file is generated by the module, I'm not sure how one would get around it.

Full transcript at the bottom.

Environment

When I first encountered problems I upgraded node to the latest LTS, v22.12.0. This has npm 10.7.0.
Upgraded the global installations of yarn and typescript, as seen in the transcript below. Then I upgraded everything in the project directory.

VS Code itself is
Version: 1.96.0 (system setup)
Commit: 138f619c86f1199955d53b4166bef66ef252935c
Date: 2024-12-11T02:29:09.626Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.17763

I am using a slightly modified version of the extension, which is why I want to test it. The nostyle branch on my fork has it. It removes the contribution point for styles.css (leaving the actual file in place) and changes the version number.

I have disabled the regular literate extension globally for testing, and my markdown previews now all use my default (dark) theme.

Transcript

PS C:\Users\rdboylan\Documents\literate> npm ls -g
C:\Users\rdboylan\AppData\Roaming\npm
+-- @vscode/vsce@3.2.1
+-- typescript@5.7.2
`-- yarn@1.22.22

PS C:\Users\rdboylan\Documents\literate> yarn
yarn install v1.22.22
warning ..\..\package.json: No license field
[1/5] Validating package.json...
warning literate@0.14.4-nostyle: The engine "vscode" appears to be invalid.
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...
success Saved lockfile.
Done in 13.28s.
PS C:\Users\rdboylan\Documents\literate> yarn pretest
yarn run v1.22.22
warning ..\..\package.json: No license field
warning literate@0.14.4-nostyle: The engine "vscode" appears to be invalid.
$ npm run compile && npm run lint

> literate@0.14.4nostyle compile
> tsc -p ./


> literate@0.14.4nostyle lint
> eslint src --ext ts

Invalid option '--ext' - perhaps you meant '-c'?
You're using eslint.config.js, some command line flags are no longer available. Please see https://eslint.org/docs/latest/use/command-line-interface for details.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
PS C:\Users\rdboylan\Documents\literate> yarn esbuild
yarn run v1.22.22
warning ..\..\package.json: No license field
warning literate@0.14.4-nostyle: The engine "vscode" appears to be invalid.
$ npm run -S esbuild-base -- --sourcemap

> literate@0.14.4nostyle esbuild-base
> esbuild ./src/extension.ts --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node --sourcemap


  out\main.js      1.8mb
  out\main.js.map  2.6mb

Done in 0.66s.
PS C:\Users\rdboylan\Documents\literate>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant