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

feat: snippet extension #3054

Merged
merged 4 commits into from
Dec 20, 2023
Merged

feat: snippet extension #3054

merged 4 commits into from
Dec 20, 2023

Conversation

Vtec234
Copy link
Member

@Vtec234 Vtec234 commented Dec 12, 2023

Summary

This makes a small addition to our take on the LSP protocol
in the form of supporting snippet text edits.
It has been discussed here on the LSP issue tracker for a while,
but seems unlikely to be added anytime soon.
This feature was requested by @PatrickMassot for the purposes
of supporting Lean code templates in code actions and widgets.

@Vtec234 Vtec234 requested a review from mhuisi as a code owner December 12, 2023 21:03
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Dec 12, 2023
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Dec 12, 2023

  • ❗ Mathlib CI will not be attempted unless you rebase your PR onto the 'nightly' branch. (2023-12-12 21:26:34)
  • ❗ Mathlib CI can not be attempted yet, as the 'nightly-testing-2023-12-20' branch does not exist there yet. We will retry when you push more commits. It may be necessary to rebase onto 'nightly' tomorrow. (2023-12-20 09:31:22)

@PatrickMassot
Copy link
Contributor

The LSP issue isn't easy to read, so let me quote it. The main point is here:

we decided that we only add something to the spec if we have an implementation in a client. Otherwise things are hard to spec and to get feedback on.

You would think the process is: 1) add some feature to the LSP spec 2) get this feature implemented in editors. But the comment above proves it goes the other way around. So indeed "insert snippets as text edits" is not yet part of the LSP specification but it is already supported by VSCode.

@david-christiansen
Copy link
Contributor

@PatrickMassot Requiring implementations before adding something to a spec is very good practice - it's difficult to know what will be good in practice without having first used it. IMHO they should require at least two completely independent implementations - this would also help discover places where the documentation or specification is lacking and help ensure that the protocol actually does meet its goal of working in multiple editors.

Copy link
Contributor

@david-christiansen david-christiansen left a comment

Choose a reason for hiding this comment

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

I have some stylistic nitpicks on docstrings.

I can think of lots of cases where this would be a really nice feature!

src/Lean/Data/Lsp/Basic.lean Outdated Show resolved Hide resolved
src/Lean/Data/Lsp/Basic.lean Outdated Show resolved Hide resolved
src/Lean/Data/Lsp/Basic.lean Outdated Show resolved Hide resolved
src/Lean/Data/Lsp/Basic.lean Outdated Show resolved Hide resolved
@PatrickMassot
Copy link
Contributor

@PatrickMassot Requiring implementations before adding something to a spec is very good practice - it's difficult to know what will be good in practice without having first used it. IMHO they should require at least two completely independent implementations - this would also help discover places where the documentation or specification is lacking and help ensure that the protocol actually does meet its goal of working in multiple editors.

I'm not complaining at all, I'm was trying to provide more context in order to avoid seeing this important PR closed by someone arguing this isn't part of the spec.

@Vtec234 Vtec234 added awaiting-review Waiting for someone to review the PR will-merge-soon …unless someone speaks up and removed awaiting-review Waiting for someone to review the PR labels Dec 16, 2023
@Vtec234 Vtec234 added this pull request to the merge queue Dec 20, 2023
@Vtec234 Vtec234 removed this pull request from the merge queue due to a manual request Dec 20, 2023
Vtec234 and others added 4 commits December 20, 2023 10:11
Co-authored-by: David Thrane Christiansen <david@davidchristiansen.dk>
@Vtec234 Vtec234 requested a review from kim-em as a code owner December 20, 2023 09:14
@Vtec234 Vtec234 enabled auto-merge December 20, 2023 09:14
@Vtec234 Vtec234 added this pull request to the merge queue Dec 20, 2023
Copy link
Contributor

@mhuisi mhuisi left a comment

Choose a reason for hiding this comment

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

Very late approval, but these changes look good to me.

Merged via the queue into master with commit 2644b23 Dec 20, 2023
7 checks passed
@Vtec234 Vtec234 deleted the snippet-edit branch December 20, 2023 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN will-merge-soon …unless someone speaks up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants