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

Per-project definition file? #6

Open
jcassee opened this issue Sep 11, 2022 · 11 comments
Open

Per-project definition file? #6

jcassee opened this issue Sep 11, 2022 · 11 comments

Comments

@jcassee
Copy link

jcassee commented Sep 11, 2022

From the documentation it seems that the plugin supports only one definition file per user. Is it possible to set a project-specific definition file in some way?

@etienne-monier
Copy link
Owner

Sublime Text support system-wide as project-wide settings. For project-wide settings, refer to this documentation.

Just specify project-specific settings in .sublime-project file.

@jcassee
Copy link
Author

jcassee commented Sep 11, 2022

Sorry to be a bother, but setting it in the project does not seem to work:

{
	"folders": [
		{
			"name": "My Ledger",
			"path": "/path/to/files"
		}
	],
	"settings": {
		"definition_filename": "/path/to/files/definition.ledger"
	}
}

I still get the error "Ledger definition filename does not exists."

Weirdly, I tried to debug in the console:

>>> os.path.exists(view.settings().get("definition_filename"))
True

So maybe something else is going on. Any idea how to debug further?

@jcassee
Copy link
Author

jcassee commented Sep 12, 2022

I extracted the LedgerTools package and added some debugging to get_definition_filename. Unfortunately, the plugin is not picking up the project settings, definition_filename is taken from the user settings.

I added the following to get_definition_filename in util.py:

    # Check for filename in the context of the current file if it is not found
    if not os.path.exists(definition_filename):
        current_file = sublime.active_window().active_view().file_name()
        current_dir = os.path.dirname(current_file)
        definition_filename = os.path.join(current_dir, definition_filename)

@etienne-monier can we reopen the issue?

@ShrykeWindgrace
Copy link

I am experiencing the same issue. +1 for reopening=)

@etienne-monier
Copy link
Owner

Ok, I'll have a look on that.

@ShrykeWindgrace
Copy link

On the first sight, this is not immediately possible: per the documentation (https://www.sublimetext.com/docs/projects.html#settings-key)

Note that only settings in the category Editor Settings may be controlled by a project.

These editor settings seem to not include plugin-specific things. I'll take a look whether we can override syntax-specific settings on a project basis...

@jcassee
Copy link
Author

jcassee commented Sep 21, 2022

Indeed, that is why the code snippet above allows the definition_filename to be relative to the current file location. But maybe having it relative to the project file would be even better.

@ShrykeWindgrace
Copy link

Hello! Just a friendly reminder that there is PR addressing this issue =)

@etienne-monier
Copy link
Owner

Hi,
I'm currently making a whole refactor to make clear code and tests.

Concerning the settings, the keys are going to be configurable via the project settings file or the pluggin setting files.

@ShrykeWindgrace
Copy link

Thanks for the update!

@ShrykeWindgrace
Copy link

Hi! Any progress on this?

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

3 participants