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

languages/scala: Add scala language support #399

Merged
merged 4 commits into from
Oct 12, 2024

Conversation

ksonj
Copy link
Contributor

@ksonj ksonj commented Oct 5, 2024

Scala language support

Description

Adds basic support for Scala via nvim-metals.

This is very bare bones as of yet. It works, but metals can be configured quite extensively and none of those options are exposed via the module here yet.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

Please try to check at least a majority of the checklist before opening your pull request. Exceptions to this will be reviewed on a case by case basis.

  • My code follows the style and contributing guidelines of this project.
  • I ran Alejandra to format my code (nix fmt).
  • I have performed a self-review of my own code and tested it.
  • I have commented my code, particularly in hard-to-understand areas.
  • My changes generate no new warnings.
  • This change requires a documentation update.
  • I have updated the documentation accordingly.

@ksonj ksonj requested a review from NotAShelf as a code owner October 5, 2024 14:18
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.nvim.dag) entryAfter;

mkBinding = binding: "vim.api.nvim_buf_set_keymap(bufnr, 'n', '${binding.value}', '<cmd>lua ${binding.action}<CR>', {noremap=true, silent=true, desc='${binding.description}'})";
Copy link
Owner

@NotAShelf NotAShelf Oct 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we're defining mkBinding here and not using one of the binding functions from lib?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be just ignorance on my part. lsp/config.nix does a similar thing to set buffer local mappings, which is what I looked at.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've inlined this into attach_metals_keymaps now

modules/plugins/languages/scala.nix Outdated Show resolved Hide resolved
modules/plugins/languages/scala.nix Outdated Show resolved Hide resolved
modules/plugins/languages/scala.nix Outdated Show resolved Hide resolved
modules/plugins/languages/scala.nix Outdated Show resolved Hide resolved
modules/plugins/languages/scala.nix Outdated Show resolved Hide resolved
@ksonj
Copy link
Contributor Author

ksonj commented Oct 7, 2024

BTW this PR also has nvim-metals still pointing to a fork of mine, because with upstream I am getting a build error on generating helptags. I hope to get this merged scalameta/nvim-metals#693 to fix that.

@ksonj
Copy link
Contributor Author

ksonj commented Oct 7, 2024

Switched back to scalameta/nvim-metals for the plugin source

Copy link
Owner

@NotAShelf NotAShelf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things I'd like to see changed for the sake of consistency and for documentation.

In addition, please rebase this PR on the v0.7 branch as main is currently in a feature freeze.

modules/plugins/languages/scala.nix Outdated Show resolved Hide resolved
modules/plugins/languages/scala.nix Outdated Show resolved Hide resolved
modules/plugins/languages/scala.nix Outdated Show resolved Hide resolved
modules/plugins/languages/scala.nix Outdated Show resolved Hide resolved
modules/plugins/languages/scala.nix Outdated Show resolved Hide resolved
modules/plugins/languages/scala.nix Outdated Show resolved Hide resolved
Adds LSP support for Scala via nvim-metals
@ksonj ksonj changed the base branch from main to v0.7 October 9, 2024 09:57
@NotAShelf
Copy link
Owner

NotAShelf commented Oct 10, 2024

If you could add a changelog entry, I think I can merge this later today.

Copy link
Owner

@NotAShelf NotAShelf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some more things I'd like to change, but I think I'll handle those myself in the #382 eventually.

Thanks.

@NotAShelf NotAShelf merged commit caaacbf into NotAShelf:v0.7 Oct 12, 2024
7 checks passed
@NotAShelf NotAShelf mentioned this pull request Oct 14, 2024
@github-actions github-actions bot deleted the scala-support branch November 15, 2024 04:02
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

Successfully merging this pull request may close these issues.

2 participants