LogtalkDotOrg / logtalk-for-vscode

Logtalk for VSCode extension
MIT License
5 stars 1 forks source link

FR: better directory awareness #10

Open cl-alexk opened 4 months ago

cl-alexk commented 4 months ago

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:

pmoura commented 4 months ago

Partial fix (requires latest Logtalk git version):

logtalk-for-vscode-0.23.0.vsix.zip

From the release notes:

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

pmoura commented 4 months ago

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

cl-alexk commented 2 months ago

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.