Skip to content

refact: deprecate snippets ext. point and add samples ext. point#892

Merged
mickaelistria merged 1 commit into
eclipse-tm4e:mainfrom
sebthom:samples
Jun 2, 2025
Merged

refact: deprecate snippets ext. point and add samples ext. point#892
mickaelistria merged 1 commit into
eclipse-tm4e:mainfrom
sebthom:samples

Conversation

@sebthom
Copy link
Copy Markdown
Member

@sebthom sebthom commented May 31, 2025

This addresses #147. The old "snippets" extension point is still functional so no immediate change required by grammar providers.

Old:

   <extension
         point="org.eclipse.tm4e.ui.snippets">
      <snippet
            name="org.eclipse.tm4e.ui.tests.snippet1"
            path="grammars/snippet.ts"
            scopeName="source.ts">
      </snippet>
   </extension>

New:

   <extension
         point="org.eclipse.tm4e.ui.samples">
      <sample
            name="org.eclipse.tm4e.ui.tests.sample1"
            path="grammars/sample.ts"
            scopeName="source.ts">
      </sample>
   </extension>

@sebthom
Copy link
Copy Markdown
Member Author

sebthom commented May 31, 2025

We could also name the extension point org.eclipse.tm4e.ui.grammarPreviewSamples to be precise, e.g.

   <extension
         point="org.eclipse.tm4e.ui.grammarPreviewSamples">
      <sample
            name="org.eclipse.tm4e.ui.tests.sample1"
            path="grammars/sample.ts"
            scopeName="source.ts">
      </sample>
   </extension>

I'd like to avoid the term snippet at all since it has a very different meaning in TextMate https://macromates.com/textmate/manual/snippets

@sebthom sebthom requested a review from mickaelistria May 31, 2025 18:14
@mickaelistria
Copy link
Copy Markdown
Contributor

I'm fine with such renames. Theorically, we'd also keep ISnippet and ISnippetManager are deprecated; but if we can ensure enough those have no users, it's OK to delete them too.

@sebthom
Copy link
Copy Markdown
Member Author

sebthom commented Jun 2, 2025

I'm fine with such renames. Theorically, we'd also keep ISnippet and ISnippetManager are deprecated; but if we can ensure enough those have no users, it's OK to delete them too.

I already did a thorough search on Google and GitHub and could not find any references to ISnippet and ISnippetManager in any external code so I think it is safe to rename them.

@mickaelistria
Copy link
Copy Markdown
Contributor

OK, good.

@mickaelistria mickaelistria merged commit ad7ab36 into eclipse-tm4e:main Jun 2, 2025
23 checks passed
@sebthom sebthom mentioned this pull request Jun 2, 2025
@angelozerr
Copy link
Copy Markdown
Contributor

Thanks @sebthom for this change which was very bad.

So now we have snippet as free, I think it would be very nice to implement VSCode snippet https://code.visualstudio.com/docs/editing/userdefinedsnippets

Even if Eclipse IDE provide this feature with Template, I think it can be a very good idea to support it, because you could just copy/paste existing snippet from existing vscode extension.

@sebthom
Copy link
Copy Markdown
Member Author

sebthom commented Jun 2, 2025

The org.eclipse.tm4e.ui.snippet extension point is still in use otherwise we'd break clients. But one could definitively add a org.eclipse.tm4e.ui.snippets now.

@mickaelistria
Copy link
Copy Markdown
Contributor

mickaelistria commented Jun 2, 2025

But one could definitively add a org.eclipse.tm4e.ui.snippets now.

We can also keep the legacy org.eclipse.tm4e.ui.snippets extension point, and let it have a new snippet child element and only deprecate the samplechild element.

@sebthom sebthom deleted the samples branch June 2, 2025 09:28
@sebthom
Copy link
Copy Markdown
Member Author

sebthom commented Jun 2, 2025

I made a typo in the PR, the old one actually looks like this:

   <extension
         point="org.eclipse.tm4e.ui.snippets">
      <snippet
            name="org.eclipse.tm4e.ui.tests.snippet1"
            path="grammars/snippet.ts"
            scopeName="source.ts">
      </snippet>
   </extension>

But yes we could only deprecate the <snippet> element and introduce a new one for TM snippets.

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.

3 participants