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

lsp-dart treat current-buffer as entry function when run lsp-dart-run. #173

Closed
zw963 opened this issue Jun 30, 2022 · 6 comments
Closed

Comments

@zw963
Copy link

zw963 commented Jun 30, 2022

lsp-dart work REALLY REALLY WELL recent days! with offical debugger.

only one concern, when i run lsp-dart-run, it let me device,
but, it not let me select the entry function. in fact, it always
use current open buffer as entry, that not work well. will make
start failed.

the, the corrent working processing is, open project, and open
lib/main.dart first(this step is necessory), run lsp-dart-run to start work.

so, do we consider set lib/main.dart as a default?

or at least, add a option make lib/main.dart as default instead.

Thank you.

@ericdallo
Copy link
Member

For dart projects, lsp-dart does this:

(or (lsp-dart-get-project-entrypoint)
    (buffer-file-name))

that function lsp-dart-get-project-entrypoint checks the variable lsp-dart-program-entrypoints which already include the lib/main.dart, so not sure why it's not working for you

@zw963
Copy link
Author

zw963 commented Jun 30, 2022

(lsp-dart-get-project-entrypoint)

Sorry, i consider maybe i run lsp-dart-run too early, even before lsp start sucessful.

i will back if other issue.

@zw963 zw963 closed this as completed Jun 30, 2022
@zw963
Copy link
Author

zw963 commented Jul 7, 2022

Hi, this issue still happen even lsp after is started successful.

Follow is some clue, though, i don't know if relative to.

  1. open my project use emacs .&
  2. open lib/pages/about.dart
  3. waiting lsp start correctly
  4. run lsp-dart-run, here we have two options available.

image

  1. move to select secondary one (maybe this step is wrong?)
  2. Get following wrong message:
    Launching lib/pages/about_page.dart on Linux in debug mode...
  3. i test on chrome mode(it not the first candidate), it not work too.

So, how can i offer more logs on this issue?

Thank you.

EDIT

i guess i found the reason,

When i open project root folder use step 1, (lsp-dart-get-project-entrypoint) return correct value.

But, when i open lib/pages/about.dart, (lsp-dart-get-project-entrypoint) failed instead return nil,

I guess that caused by, when i open project root folder, the default-directory return correct value: like "~/my_project_root/",

but, when i open about.dart, default-directory change to "/home/zw963/my_project_root/lib/pages/" instead.

@zw963 zw963 reopened this Jul 7, 2022
@ericdallo
Copy link
Member

Yeah, that's the problem, we should'n use default-directory, but probably lsp-workspace-root

@zw963
Copy link
Author

zw963 commented Jul 8, 2022

Yeah, that's the problem, we should'n use default-directory, but probably lsp-workspace-root

But, when i open project root folder use step 1, lsp-workspace-root not exists, it only exists after i open a dart file in current project, and after lsp start correct, so, we still need check the return of this function if nil, if nil, we can use default-directory instead?

@ericdallo
Copy link
Member

@zw963 it should be fixed to use lsp-workspace-root, could you try again?

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

2 participants