Comments (1)
I am going to close this issue as something we don't intend on adding to the language, but I'd like to give you our reasoning as this is something that we've discussed a fair bit before internally way back in the pre v1 release days of Yarn Spinner.
So the first and major issue is adding multi-line comments actually adds a surprisingly large amount of complexity to the parsing of yarn (or any language tbh).
In that correctly handling all the nesting of comments and mixing elements that aren't comments but look the same is particularly brutal to the parser grammar.
As an example of this:
/*
Calculator: hello, I am a calculator
Player: What can you do?
Calculator: I can perform the following +-*/
*/
Sure this example is one I made up on the spot but how should this be handled?
And this is true with also just nesting the multi-line comments in general.
So take the following example:
/*
Here is some regular text
/*
Here is some more text inside a nested comment
*/
Here is some text outside the nested comment
*/
In this current form should the parser have seen two comment blocks or one?
And where should the top level comment end?
If we delete the top comment opening terminal is there now an error?
So the options are to:
- not allow multi-line comments
- not allow multi-line comment elements nested inside multi-line comments
- force users to escape multi-line comment elements
- implement nested comment ranges and handle every edge case that presents
Secondly in our recommended editor of VSCode if you select a block of text and press Ctrl
(or Command on macOS) and /
it will automatically append the //
comment terminal to the front of the line.
Pressing Ctrl
+ /
again will remove the //
, giving an easy way to comment and uncomment lines in bulk.
Overall we decided that the quick line comment feature of VSCode gives enough of the benefits of multi-line comments, without any of the edge cases, so we haven't implemented them.
I hope this clears up why we don't see any real benefit to multi-line comments.
from yarnspinner.
Related Issues (20)
- Language Server Command Data Not Loading HOT 6
- It is possible to sneak empty or whitespace-only commands past the compiler
- `TestLineTagsAreAdded` depends on dictionary order, which is not guaranteed HOT 1
- Proposal: Options that disappear and fallback. HOT 6
- Effects.Typewriter fails when TimeScale is 0 HOT 1
- Variables corrupted (in some locales) when calling Custom Commands with float arguments HOT 2
- .ysls.json no longer read in VS Code with extension v2.2.119 HOT 1
- Running `ysc tag` appears to de-escape `\\` to just `\` HOT 2
- Proposal: Smart Variables HOT 5
- Proposal: Decide on string interpolation rules for lines and commands
- Fully qualified yarn commands don't get detected by the LSP HOT 1
- Unexpected "[" while reading a shortcut option statement HOT 1
- yarn function comments are being truncated to the first line HOT 1
- C# command registration uses argument as literal rather than resolved value HOT 3
- Empty nodes are included in the compiled output
- TryGetValue<T> called with type IConvertible. HOT 1
- Variable declaration inference breaks on certain sets
- Some built in functions are saying they return any instead of their appropriate return type in the LSP
- empty nodes create a weird error message from the LSP
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yarnspinner.