Comments (4)
We can fix this by not removing unmatched delimiters. I think this solves the problem completely for single line strings, because delimiters are then only removed when they fall at the end of a line. And by definition of a single string, the contents of the string will always end with a quote, preventing its removal.
This doesn't help multiline strings:
(def foo
"(a b)
c")
Inserting two quotes on the second line results in this:
(def foo
""
"(a b
c")
So I think the true solution is to just hold prevent processing if there is an unmatched quote anywhere in the file.
from parinfer.js.
Another breaking bug caused by quotes in comments being overtaken by strings:
Steps to recreate. Delete the quote at the end of line 2, and reinsert it.
(def foo
""
"(a b)
c" ;; "
c)
You will get this:
(def foo
""
"(a b
c" ;; ")
c)
from parinfer.js.
crazy idea: detect if there are an even number of unescaped quotes in a string. if there aren't, escape the last one so that an imbalanced string state will be guaranteed to pass through it.
with all these crazy cases coming up, maybe parinfer should just be isolated to a "restructure selection by indentation" function in an editor.
from parinfer.js.
escaping quotes in comments was a bad idea, we can't quickly comment/uncomment a line of code with a string in it.
I will just make a note that strings must be balanced in comments
from parinfer.js.
Related Issues (20)
- multiple dedents from reformat HOT 1
- test multiple changes HOT 2
- redundant indentation HOT 1
- How to make multi-line maps HOT 3
- new plugin for a multi-user browser REPL (REPtiLe) HOT 1
- Bug in multi-line Raise operation HOT 4
- Parinfer Parens Mode bug HOT 5
- add dates to the CHANGELOG HOT 1
- minor doc change
- Namespaced map indentation doesn't agree with cljfmt HOT 5
- Disable graying out of ending parens HOT 1
- how to add indentation rules for custom forms? HOT 1
- evil-commentary don't work HOT 4
- support for comment characters other than semicolon HOT 1
- Align map values HOT 1
- Allow unbalanced brackets in symbols HOT 4
- Test optional returned values in markdown files
- How to support other Lisp dialects HOT 2
- Parlinter is archived, what to use instead? HOT 4
- Add closing quote? HOT 1
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 parinfer.js.