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

Jump to editor for devcontainers #33

Open
3 tasks done
xiki808 opened this issue Apr 24, 2024 · 10 comments
Open
3 tasks done

Jump to editor for devcontainers #33

xiki808 opened this issue Apr 24, 2024 · 10 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@xiki808
Copy link

xiki808 commented Apr 24, 2024

Clear and concise description of the problem

In my local environment I'm using vscode devcontainers, hence I'm loading my code from within a docker container. The jump to editor link is not working with this setup, any chance to add this feature?

Suggested solution

Jump to editor within a devcontainer setup

Alternative

No response

Additional context

No response

Validations

@xiki808 xiki808 added the enhancement New feature or request label Apr 24, 2024
@yuyinws
Copy link
Member

yuyinws commented Apr 25, 2024

Thanks for your report.
With the latest version.
You can pass specifiedEditor option to launch editor for vscode devcontainers:

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import TurboConsole from 'unplugin-turbo-console/vite'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    TurboConsole({
      specifiedEditor: 'code'
    })
  ],
})

@yuyinws yuyinws closed this as completed Apr 25, 2024
@xiki808
Copy link
Author

xiki808 commented Apr 25, 2024

I tested with the new version, the launch link now takes me to a new tab, which displays this:

image

I haven't seen any difference when running with specifiedEditor: 'code'

On checking the /inspect I see this:

image

For my docker setup, I do have a port forward for 3070

@yuyinws yuyinws reopened this Apr 25, 2024
@yuyinws
Copy link
Member

yuyinws commented Apr 26, 2024

Please follow these steps on your devcontainers to troubleshooting:

  1. Make sure code command has installed.
  2. Make sure your local(outside devcontainers) dev environment no 3070 ports are occupied.
  3. Clone this repo and run node test.js, and check jump editor whether normal.
  4. Clone this repo and run pnpm dev, click the output on the console panel and and check jump editor whether normal.

At the same time, please pay attention to whether the terminal prints out some errors.

@xiki808
Copy link
Author

xiki808 commented Apr 26, 2024

Hi @yuyinws, thanks will test it out today. I'm guessing I should run the tests on the container right?

I missed to mention I'm using WSL2 too

@yuyinws
Copy link
Member

yuyinws commented Apr 26, 2024

Yes, run the tests on the container.

@xiki808
Copy link
Author

xiki808 commented Apr 26, 2024

Within the container I cloned launch editor, ran npm install and on node test.js it opens the packages/launch-editor/index.js file successfully in the current window.

Within the container I cloned vite turbo console, ran pnpm install and then pnpm dev. I get the following output:

image

Clicking on the local link it redirects to the browser but with URL: http://0.0.0.0:10104/. That port is the correct port that is mapped to 5173 within the container. The browser doesn't know about 0.0.0.0, but only localhost. http://localhost:10104/ would work

Clicking on Turbo console, it opens this url: http://localhost:3070/inspect and I get the empty inspect as I demonstrated above.

@xiki808
Copy link
Author

xiki808 commented Apr 26, 2024

I tried mapping port 3070:3070 from host to container, but when I run vite turbo console and clicking on the turbo console link, I'm redirected to http://0.0.0.0:3070/inspect, which since of 0.0.0.0 the browser does not know about.

If I change the url to http://localhost:3070/inspect, I still get an empty inspect

@yuyinws
Copy link
Member

yuyinws commented Apr 26, 2024

I simulate your development environment and it works normal. I think this may be due to port mapping.

(check below gif)

Kapture 2024-04-26 at 22 42 16

@xiki808
Copy link
Author

xiki808 commented Apr 27, 2024

I think the issue could be that my vite port mapping is a different fixed port, for example in my case: 10107:5173

Would be nice to have a config to specify that port 🙏

@xiki808
Copy link
Author

xiki808 commented Apr 27, 2024

Gave it a test so vite port mapping was the same 5173:5173 as you can see below

image

Unfortunately only partial success, inspect page shows me the file, but on the launcher link click, it only opens the "everything is normal" new tab, rather than redirecting to the editor

image

@yuyinws yuyinws added bug Something isn't working help wanted Extra attention is needed and removed enhancement New feature or request labels Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants