Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TypeError: String required" #41

Open
xaedes opened this issue Sep 20, 2017 · 0 comments
Open

"TypeError: String required" #41

xaedes opened this issue Sep 20, 2017 · 0 comments

Comments

@xaedes
Copy link

xaedes commented Sep 20, 2017

I get following error when trying to convert camel case text to underscore:

Traceback (most recent call last):
File "...\Sublime3\sublime_plugin.py", line 818, in run_
return self.run(edit)
File "...\Sublime3\Data\Packages\StringUtilities\stringutilities.py", line 117, in run
self.view.replace(edit, region, text)
File "...\Sublime3\sublime.py", line 823, in replace
sublime_api.view_replace(self.view_id, edit.edit_token, r, text)
TypeError: String required

The real issue happens here:

https://github.com/akalongman/sublimetext-stringutilities/blob/master/stringutilities.py#L116

This code may set the variable text to a boolean value, which triggers the "TypeError: String required".

This code may be fixed by replacing it by:

if '_' in text and text[0].islower():
    text = self.toCamelCase(text)
else:
    text = self.toUnderscores(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant