Comments (4)
Thanks for the report. You are right, it is inconvenient.
However, I am not sure how to solve this problem, because it is not obvious how to handle a sequence of uppercase letters in PascalCase.
For example, if I want to change the word "LicenseMIT" from PascalCase to snake_case, how should that be handled? What about the case of "ParseCLanguage"?
from dial.nvim.
Using Regex Lookahead, a sequence of capital letters can be considered a single word.
Here is an example in JavaScript:
const regex = /[A-Z]([A-Z](?![a-z]))+|[A-Z][a-z]*/g
'LicenseMIT'.match(regex)
// -> ['License', 'MIT']
'ParseCLanguage'.match(regex)
// -> ['Parse', 'C', 'Language']
'JSONToYAMLConverter'.match(regex)
// -> ['JSON', 'To', 'YAML', 'Converter']
In this case, however, there are some probrems.
- The capital parts cannot be restore once convert to snake_case:
LicenseMIT -> license_mit -> LicenseMit
- The sequence of capital-only-word cannot be detect:
JSONYAMLConverter -> jsonyaml_converter
It is a difficult problem and it may good to ignore the word that has a sequence of capital letters.
I reported this issue because the behavior was different from the help.
from dial.nvim.
Yes, as you say, the current implementation is compatibility oriented.
However, the word detection algorithm could use a little more improvement. It may be possible to sacrifice compatibility for greater convenience.
from dial.nvim.
@monaqa A "potential" solution/workaround could be to implement something similar to ActiveSupport::Inflections#acronym
and then keep the current algorithm as it is
from dial.nvim.
Related Issues (20)
- Can't seem to get dial.nvim to function? HOT 5
- How to create switch between ES6-style arrow and normal functions? HOT 2
- enhancement: add treesitter queries support for augend.user HOT 3
- Enhancement: Add case-insensitive cycling HOT 2
- Enhancement: Extending dial with support for conversions HOT 1
- New date augend: day/month, i.e. %d/%m
- [Feature Request] Option to only inc/dec when augend is under cursor HOT 7
- Couple of issues HOT 5
- Question on aligning (string formatting) date augend HOT 2
- Attempt to call method 'find' error HOT 2
- Visual block mode increment HOT 3
- Sumneko warning HOT 3
- Date decreasing issue HOT 5
- Workflow proposal HOT 14
- Provide a lua API instead of a string command HOT 1
- Feature request: Support for sequences HOT 2
- lazy.nvim: Failed to run config for dial.nvim: module 'dial' not found HOT 2
- Date pattern like %-m don't work. HOT 15
- Increment/decrement on fooBar1 while cursor is over the 1 HOT 3
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 dial.nvim.