Giter VIP home page Giter VIP logo

caseconversion's People

Contributors

anaminus avatar bfelder avatar bizoo avatar curtisgibby avatar fpuc avatar gavinhigham avatar gentoo90 avatar ivans avatar jdavisclark avatar jpcirrus avatar pankdm avatar stoivo avatar tbasse avatar wam avatar westacular avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

caseconversion's Issues

global conversion

I'd like to see a "file" "global" option to do this for all instances in a file or in a project tree.

Title Case functionality and hotkey

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)

Inconsistent camelCase

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!

to_snake_case(text) do not work

Hello,

I can exchange to_camel_case and to_pascal_case, but to_snake_case the word remains the same.

Word: example_word

  • to_camel_case i get ExampleWord that is what i expected.
  • to_pascal_case i get exampleWord, that is what is to be expected.
  • to_snake_case the word still the same no matter if i have ExampleWord or exampleWord.

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:

  • strip_wrapping_underscores.

You deal with underscores in function to_pascal_case at line 27, so is really necessary to use the other function?

Best Regards

Please provide multi-line support

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

Accented characters

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.

capitalized acronyms split by underscores using snake case conversion. Would be great to have option to preserve grouping

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.

Additional cases: lowercase, uppercase, capitalize

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.

[Feature] More generic toggle_case

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?

Conversion of multiple lines remove the return carriage

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.

Made a pypi package

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.

ctrl-alt-/ is a bad shortcut on german layouts

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.

Ada_Case option

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

[Bug] Non-ASCII symbols not converted

1. Summary

Non-ASCII symbols not converted for me.

2. Expected behavior

Case Conversion

  1. Native Sublime Text Convert Case — Upper Case, Lower Case and so on — successfully work for me in Non-ASCII symbols.
  2. Case Conversion worked for me for Latin letters.

3. Actual behavior

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

4. Steps to reproduce

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+PConvertCase: camelCase → I get actual behavior.

5. Environment

Operating system and version:
Windows 10 Enterprise LTSB 64-bit EN
Sublime Text:
Build 3126

Thanks.

Major Update in the Making - Help wanted

@jdc0589 and all other who love this Sublime plugin
Find a major overhaul of CaseConversion in this fork: HERE

Updates include:

  • pythonized code: E.g. no more if x != None:
  • major refactoring of the parser. It is now class based, different functionalities like acronym detection have been cleanly separated into different methods.
  • also all string construction is now done in 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)
  • added three new case conversions: to_lower_case, to_upper_case, to_capital_case. (See Issue 36)
  • case toggling can now be customized (See Issue 25). The user can determine what a target case a case should be converted to. Simply defining key: value pairs in the settings file under the point toggle_cases is enough.
    With key being the source case and the value being the target case. Default setting leaves toggling sequence as it was up until now.

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

Update on Package Control

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.

snake case is not working S-3

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

Does this plugin support ST3?

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.

snake_case conversion eats existing underscores

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

Vim support?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.