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

Add support for Pkl #6718

Closed
wants to merge 1 commit into from
Closed

Conversation

sgammon
Copy link

@sgammon sgammon commented Feb 25, 2024

Adds support for the new Pkl configuration language from Apple.

Description

Credit to:

Fixes and closes #6705
Fixes and closes apple/pkl#155

Changelog

  • feat: language support for Apple Pkl with textmate bundle
  • feat: heuristics to distinguish with Python Pickle
  • test: tests/samples for Apple Pkl configuration language

Checklist:

  • I am adding a new extension to a language.

    • The new extension is used in hundreds of repositories on GitHub.com
    • I have included a real-world usage sample for all extensions added in this PR:
      • Sample source(s):
        • [URL to each sample source, if applicable]
      • Sample license(s):
    • I have included a change to the heuristics to distinguish my language from others using the same extension.
  • I am adding a new language.

    • The extension of the new language is used in hundreds of repositories on GitHub.com.
      • Search results for each extension:
        • Here, but it is hard to distinguish Pkl sources from Pickle (Python) data
    • I have included a real-world usage sample for all extensions added in this PR:
    • I have included a syntax highlighting grammar: Grammar here
    • I have added a color
      • Hex value: #6b9543
      • Rationale: Main color (outer gear green) used in the Pkl project icon
    • I have updated the heuristics to distinguish my language from others using the same extension.
  • I am fixing a misclassified language

    • I have included a new sample for the misclassified language:
      • Sample source(s):
        • [URL to each sample source, if applicable]
      • Sample license(s):
    • I have included a change to the heuristics to distinguish my language from others using the same extension.
  • I am changing the source of a syntax highlighting grammar

    • Old: [URL to grammar repo]
    • New: [URL to grammar repo]
  • I am updating a grammar submodule

  • I am adding new or changing current functionality

    • I have added or updated the tests for the new or changed functionality.
  • I am changing the color associated with a language

    • I have obtained agreement from the wider language community on this color change.
      • [URL to public discussion]
      • [Optional: URL to official branding guidelines for the language]

Signed-off-by: Dario Valdespino <dvaldespino00@gmail.com>
Signed-off-by: Sam Gammon <sam@elide.ventures>
@sgammon sgammon changed the title Add support for PKL Add support for Pkl Feb 25, 2024
@sgammon sgammon marked this pull request as ready for review February 25, 2024 20:32
@sgammon sgammon requested a review from a team as a code owner February 25, 2024 20:32
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

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

See inline comments.

Also:

Here, but it is hard to distinguish Pkl sources from Pickle (Python) data

Search accepts regexes now so you can use your heuristic to confirm popularity.

@@ -1353,3 +1356,6 @@
[submodule "vendor/grammars/zephir-sublime"]
path = vendor/grammars/zephir-sublime
url = https://github.com/phalcon/zephir-sublime
[submodule "vendor/grammars/language-pkl"]
path = vendor/grammars/language-pkl
url = https://github.com/nishtahir/language-pkl.git
Copy link
Member

Choose a reason for hiding this comment

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

Whoops. There should only be one new addition and the file should be alphabetised (that's what the script/add-grammar script does. This last entry shouldn't be here.

- extensions: ['.pkl']
rules:
- language: Pkl
pattern: 'new|class|function|import|module|(\w+\s*({|=))'
Copy link
Member

Choose a reason for hiding this comment

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

This looks waaaay too loose as it'll match those first few strings anywhere in the line, eg it'll match "this new language is pkl" or "I came first in my class" or "this functionality is awesome" or "imported cheese smells". You probably don't want this 😉.

@lildude
Copy link
Member

lildude commented Feb 26, 2024

Oh yes, and we're going to also need a test for the heuristic.

@stackoverflow
Copy link

Hi @sgammon. We're preparing a PR for linguist, it should come soon. The grammar you are using in this submission is our current vscode one, which is pretty bare bones, we have a updated version of it now.

@sgammon
Copy link
Author

sgammon commented Feb 26, 2024

@stackoverflow Ah, good to know 😄. We can close this PR or point at the new grammar, entirely up to you guys.

@sgammon
Copy link
Author

sgammon commented Feb 26, 2024

Closing for now, can re-open if needed

@sgammon sgammon closed this Feb 26, 2024
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.

Add pkl to GitHub linguist Add support for the Pkl configuration language
4 participants