[Nix#10099] String type hint #53

Open
opened 2024-03-16 06:44:39 +00:00 by lix-bot · 0 comments
Member

Upstream-Issue: NixOS/nix#10099

Is your feature request related to a problem? Please describe.

In Nix, it isn't uncommon to embed other languages (mostly bash, but not always bash), with Nix Language as string.
But those strings have no type hint to help editor, formatter, and other tools.

Describe the solution you'd like

This is an issue but should be an RFC, because any solution would evolve to one anyway.

I Would like to have some language feature for that, like info string (lang name after backticks) from markdown.

ie:

{ 
  # ... 
  myCode = '''python
    def myPythonCode():
      print("helloWorld")
  ''';
}

Suggested 3 single quotes instead of two, but needs to be discussed.

Not sure how that could conflict with #228

Describe alternatives you've considered
An RFC to increment RFC 0145 (Doc-comments) to include some kind of special comment

ie:

{ 
  # ... 
  myCode = /*** python */ ''
    def myPythonCode():
      print("helloWorld")
  '';
  myOther = ''
    def myPythonCode():
      print("helloWorld")
  '';/** python */ 
}

Additional context
I vaguely remember someone commented something similar to this in Nix Forum.

It is a usability issue, for best usability it should be a lang feature, for best compatibility it should be a doc comment extension (if we follow that path, close this).

Priorities

Add 👍 to issues you find important.

Upstream-Issue: https://git.lix.systems/NixOS/nix/issues/10099 **Is your feature request related to a problem? Please describe.** In Nix, it isn't uncommon to embed other languages (mostly bash, but not always bash), with Nix Language as string. But those strings have no type hint to help editor, formatter, and other tools. **Describe the solution you'd like** This is an issue but should be an RFC, because any solution would evolve to one anyway. I Would like to have some language feature for that, like [info string](https://spec.commonmark.org/0.31.2/#info-string) (lang name after backticks) from markdown. ie: ```nix { # ... myCode = '''python def myPythonCode(): print("helloWorld") '''; } ``` Suggested 3 single quotes instead of two, but needs to be discussed. Not sure how that could conflict with #228 **Describe alternatives you've considered** An RFC to increment [RFC 0145](https://github.com/NixOS/rfcs/pull/145) (Doc-comments) to include some kind of special comment ie: ```nix { # ... myCode = /*** python */ '' def myPythonCode(): print("helloWorld") ''; myOther = '' def myPythonCode(): print("helloWorld") '';/** python */ } ``` **Additional context** I vaguely remember someone commented something similar to this in Nix Forum. It is a usability issue, for best usability it should be a lang feature, for best compatibility it should be a doc comment extension (if we follow that path, close this). **Priorities** Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
lix-bot added the
imported
label 2024-03-16 06:44:39 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#53
No description provided.