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

FR: better directory awareness #10

Open
cl-alexk opened this issue Jun 23, 2024 · 3 comments
Open

FR: better directory awareness #10

cl-alexk opened this issue Jun 23, 2024 · 3 comments

Comments

@cl-alexk
Copy link

cl-alexk commented Jun 23, 2024

Currently "Make - Reload" and "Run Tests" actions are sensitive to the context of the active editor file. If I'm currently looking at a file elsewhere in a .../different-dir/ (e.g. editing a test fixture not in the same directory with loader.lgt and tester.lgt) and execute "Run Tests", this not only misses running the tests but also ruins my Logtalk session:

?- vscode::tests('/Users/.../different-dir','/Users/../different-dir/tester').
!     Existence error: file '/Users/../different-dir/tester' does not exist
!       in goal: logtalk_load('/Users/../different-dir/tester',[reload(always)])
!       with execution context:
!         entity:            vscode
!         sender:            user
!         this:              vscode
!         self:              vscode
!         meta-call context: []
!         coinduction stack: []
!     Typo in the file name or in the file path? If using a relative path,
!     also check that the current directory is the expected one.
!     

Then switching back to a source code file in project dir and running "Run tests" again:

?- vscode::tests('/Users/.../project-dir','/Users/.../project-dir/tester').
ERROR: No permission to reuse alias "vscode_test_results": already taken

The cure is to kill and restart.

A nicer behavior would be:

  • After the initial "Load Directory", vscode remembers that this happened and where that directory is
  • Subsequent "Make - Reload", "Run Tests", etc. actions execute in that directory instead of the current directory of the active focused file
  • Rerunning "Load Directory" on a different file updates the current working directory (to allow switching projects within a session)
@pmoura
Copy link
Member

pmoura commented Jun 23, 2024

Partial fix (requires latest Logtalk git version):

logtalk-for-vscode-0.23.0.vsix.zip

From the release notes:

  • Fix the "Logtalk: Run Tests" command to print a warning if the tester file doesn't exist
  • Fix the "Logtalk: Run Doclet" command to print a warning if the doclet file doesn't exist

Note that you also have a "Logtalk: Run Testers (workspace)" command.

@pmoura
Copy link
Member

pmoura commented Jun 25, 2024

From your description, I assume that you have several folders with different projects in the same window/workspace?

@cl-alexk
Copy link
Author

From your description, I assume that you have several folders with different projects in the same window/workspace?

I do, but they are not open. In this particular case I'm looking at a non-Logtalk file (e.g. a data fixture) in a subdirectory in the workspace.

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