akalongman / akalongman/sublimetext-stringutilities

"TypeError: String required"

Abierto
#41 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
83
Forks
23
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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:

```python
if '_' in text and text[0].islower():
text = self.toCamelCase(text)
else:
text = self.toUnderscores(text)
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.