jdavisclark / caseconversion Goto Github PK
View Code? Open in Web Editor NEWCase conversion plugin (pascal, camel, snake) for sublime text 2
License: MIT License
Case conversion plugin (pascal, camel, snake) for sublime text 2
License: MIT License
Is it possible to convert
Admin/SomeModule/UsedClass.php
to
Admin\SomeModule\UsedClass.php
but not to
Admin\Some\Module\Used\Class\php
and vice-versa?
I love this plugin so much I can't remember what coding was like without it.
But I'm planning on an eventual conversion from SublimeText to Vim. Does this plugin possibly work in Vim? Or do you know of any alternatives that will?
It'd be really hard to give this plugin up.
First of all,
Thanks for really cool package <3
but I have issue now with (snake case), it's not working!!
and also (ctrl+shift+-) not working also, I think because snake issue.
I use Sublime 3143, Ubuntu 17.04
Hi! Your project is really great! But it doesn't support accented characters well. Right now, converting the word "préféré" for instance will return "pr_f_e_r", which is much less readable then "prefere".
I added those lines in case_parse.py (39), which doesn't handle all cases, but help a little bit :
arrayR = [(u'\xc9', 'e'),(u'\xc8', 'e'),(u'\xca', 'e'),(u'\xe8', 'e'),(u'\xe9', 'e'),(u'\xea', 'e'),(u'\xc0', 'a'),(u'\xc1', 'a'),(u'\xc2', 'a'),(u'\xe0', 'a'),(u'\xe1', 'a'),(u'\xe2', 'a')]
for a,b in arrayR:
var = var.replace(a,b)
I hope this can help.
Could you please add a hotkey for making things title case?
I'm thinking either of the following hotkeys would suit this, but would prefer the latter:
ctrl + alt + c
, ctrl + alt + t
(Title Case)
ctrl + alt + c
, ctrl + alt + j
(Jaden Smith Case)
Hi,
The github and package-control description for this plugin say:
Case conversion plugin (pascal, camel, snake) for sublime text 2
Does this mean it does not support ST3?
Thanks.
I'd like to see a "file" "global" option to do this for all instances in a file or in a project tree.
Non-ASCII symbols not converted for me.
Case Conversion features don't worked for me for Cyrillic letters. I get stack trace.
command: convert_to_camel
Traceback (most recent call last):
File "D:\Sublime Text 3 x64\sublime_plugin.py", line 818, in run_
return self.run(edit)
File "case_conversion in D:\Sublime Text 3 x64\Data\Installed Packages\Case Conversion.sublime-package", line 104, in run
File "case_conversion in D:\Sublime Text 3 x64\Data\Installed Packages\Case Conversion.sublime-package", line 87, in run_on_selections
File "case_conversion in D:\Sublime Text 3 x64\Data\Installed Packages\Case Conversion.sublime-package", line 31, in to_camel_case
IndexError: list index out of range
The problem is reproduced for me in a version of Sublime Text without plugins and user settings.
I have any Cyrillic text, for example,
Кристина Беспрецедентна
I select text → Ctrl+Shift+P → ConvertCase: camelCase
→ I get actual behavior.
Operating system and version:
Windows 10 Enterprise LTSB 64-bit EN
Sublime Text:
Build 3126
Thanks.
Hey, wanted to thank you for your work on this plugin. I found myself needing a python package that did the same conversions and none seemed to exist that sufficed (or could handle CONTANT_CASE
to dash-case
conversion).
So I put it up on Pypi here: https://pypi.python.org/pypi/case_conversion/1.0.1
Here's the github repo: https://github.com/AlejandroFrias/case-conversion
I changed the names so it looked more like type casting, added some aliases for dashcase
that are common and added some thorough testing for sanity check. Otherwise, it's a relatively straight forward port of the non-Sublime aspects of this plugin. You could even factor out that stuff now and import this...
I mostly wanted to let you know I did this in case you had any issues with how I gave you credit. If you want more or less credit, just let me know (but I did use your copy right and mentioned all the contributors in the README.
Hi,
well it might be that there are not that much users of this plugin on the net that have a german keyboard layout, but the slash is there on shift-7.
Since we also have to keep ctrl-alt pressed (which itself is a replacement for AltGr, the 3rd level key indicator, and together with shift it is the 4th leve lindicator), we cannot use this shortcut by default.
Well, I can change the setting if I want to and the slash separation is not that often used, but I would suggest to use ctrl-alt-f (for forward slash) as key binding. May be both cases are possible.
@jdc0589 and all other who love this Sublime plugin
Find a major overhaul of CaseConversion in this fork: HERE
Updates include:
if x != None:
case_parse.py
and all sublime logic kept in case_conversion.py
. (This prepares these awesome string conversion capabilities to be applied in a different module. See stringase, EDIT: As of opening this issue I was unaware that the conversion function has already been factored out: https://github.com/AlejandroFrias/case-conversion)to_lower_case
, to_upper_case
, to_capital_case
. (See Issue 36)I really like all Sublime users be able to profit from these improvements. Yet, before I open a pull request I still require help to improve, expand and test the code, because I do not understand the library good enough to do it alone. Here is what I need help with:
Acronym detection broke (and I do not know why):
This still works:
CaseConvertThisHTTP -> case_convert_this_http -> caseConvertThisHTTP
This does not: 'http' is minced:
HTTPtestArgh -> h_t_t_ptest_argh -> hTTPtestArgh
Extend method to determine all case types. (See line 271)
The cleanest solution would be using a complete rewrite of the current method, which achieves case determination purely via regexp, instead of how case detection is handled right now.
Most Wanted Feature: Case Selection via Context Menu
As already discussed in Issue 26 an optional context menu to select different conversions would be highly useful. Especially since the number of cases has grown such menu would be very practical. Indeed I was half way through implementing this feature when hitting a road block. I am going to reimplement it once we are done with the open issues discussed.
Find the fork: HERE
While lowercase and uppercase conversion are already supported by Sublime's inbuilt functions, they fit thematically into this plugin as well. For reasons of completeness, they should be included.
Also capitalizing the first letter of a word would also fit well into the package's function.
Both could be implemented only with minute additions.
Hi,
Highlight text, right-click (open context menu), change case.
This is a very useful plugin for converting legacy Python code to be PEP8 compliant.
However, a common convention in Python is to use leading underscores for private variables. When performing a snake_case conversion leading and trailing underscores are lost. e.g.:
_myVar -> my_var
myVar -> my_var
Ideally those should be preserved:
_myVar -> _my_var
myVar -> my_var
Additionally, existing multiple internal underscores are converted to single underscores. e.g.:
my__Var -> my_var
Hello,
I can exchange to_camel_case and to_pascal_case, but to_snake_case the word remains the same.
Word: example_word
Let me say that i understand php, not python, but i look to your code in case_conversion.py and for a first look you have a function that you don't need:
You deal with underscores in function to_pascal_case at line 27, so is really necessary to use the other function?
Best Regards
when converting the following string to snake case
WA Licensed Surveyors (Transfer of Land Act 1893) Regulations 1961
the expected result with preseverd leading acronym "WA" was
wa_licensed_surveyors_transfer_of_land_act_1893_regulations_1961
but the returned result for this and other strings with capitalized acronyms was
w_a_licensed_surveyors_transfer_of_land_act_1893_regulations_1961
if there is an acronym anywhere in the string it is split by underscores.
it would be good to be able to configure this option to be disabled to preserve the string element, or have another form of the snake case conversion that preserves the acronym.
This plugin is very useful. I use it to convert camelCase to snake_case.
I hope you provide multi-line support, convert multi-line to multi-line, for instance:
sortField
sortType
convert to
sort_field
sort_type
another request is support consecutive uppercase letters to lowercase, only add underline before first uppercase letter.
customerBGCode -> customer_bgcode
Hi,
first of all, thanks for a great plugin! I use it daily at work and it's a huge time-saver.
I noticed today that camelCase seems to only work for some cases when the first word is all uppercase.
HTML tag
is cased correctly, whereas SCRIPT tag
is the buggy one.
Input:
HTML tag
SCRIPT tag
Expected output:
htmlTag
scriptTag
Actual output:
htmlTag
sCRIPTTag
Thanks again and hope this helps!
only ctrl+shift+- works
I need in toggle also between dash-case and dot.case. Currently toggle is defined in source code between: PascalCase, snake_case, camelCase.
What about adding new settings where one define list of cases?
The command used was convert_to_separate_words
:
File: Data/Packages/CaseConversion/case_conversion.py
63: def to_separate_words(text, detectAcronyms, acronyms):
64: words, case, sep = case_parse.parseVariable(text, detectAcronyms, acronyms, True)
65: return ' '.join(words)
trying to use and nothing happened
Well as it says in the title, the option to convert to Ada_Case would be fantastic, it's just like snake_case but where each starting letter is upper
When the selection contains underscore, e.g.
thisWontWork_WithToggleCase
Then toggling between snake_case, camelCase and PascalCase with ctrl+shift+-
doesn't work.
When I select multiple lines in a file, and try to convert the case of this lines to anything of convertions of this plugins, the words are concatenated, i.e., the return characters are removed. This dont happens with the sublime built-in conversions.
Installing currently fails with
Package Control: Error downloading package. HTTP error 404 downloading https://codeload.github.com/jdc0589/CaseConversion/zip/master.
It looks like this is due to you changing username? If you can confirm I'm happy to make the Package Control PR for you.
If you go to Edit
-> Convert Case
-> camel case
and click on it manually it works, but not with cmd + alt + c shortcuts...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.