lucasmazza / copy-as-rtf

A package to export highlighted code as RTF
Other
19 stars 14 forks source link

Error calling `pygmentize`: Error: no lexer for alias 'typescript' found #30

Closed mraible closed 7 years ago

mraible commented 8 years ago

I'm using Atom 1.7.1 on OS X El Capitan, version 10.11.4 (15E65). When I try to copy Typescript code to RTF, the following error pops up in the top right corner.

vladimir-djokic commented 8 years ago

Same here. Some kind of feedback/resolution would be nice.

asonntag commented 8 years ago

I think the mapping within copy-as-rtf/lib/grammar-mapping.coffee is incorrect. Assuming the values are Pygments, as the comments suggest, then "Bash" is not the correct value recognized by Pygments and that must be why the error is occurring. Looking at http://pygments.org/languages/, it's possible it should be called "Bash shell scripts". It's worth noting that the value associated with Python in the mapping matches the website above and alt + r does not product the same error when copying from a .py file and successfully copies to my destination.

blackat commented 8 years ago

Hi, I have just faced the same issue, it would be nice to know where the typescript lexer can be installed.

Thx in advance.

steak3 commented 8 years ago

Are you all in OSX? Which is the file extension? .ts? .typescript? I have this in Windows:

image

Typescript lexer was introduced in pygments v1.6 (http://pygments.org/docs/lexers/). Checking the dependencies versions could be a hint.

ziroplu commented 8 years ago

Updating pygments to 2.1.3 did not help on OSX :-(

steak3 commented 8 years ago

@ziroplu how did you proceed?

erikcox commented 8 years ago

I'm getting the same error as @steak3 using the latest version of Atom and pygments on Window 10.

dhowe commented 8 years ago

Similar error attempting to copy from processing sketches (via the processing-language package)

screen shot 2016-09-29 at 11 55 32 pm

Copy-as-rtf 0.9.3, Atom 1.9.9, OSX 10.10.5

setkeh commented 7 years ago

The Pull request i have just refrenced adds in a fix for the lexer issue that i and a few freinds have noticed with bash. It has been tested on MacOS and Windows thus far.

irace commented 7 years ago

Any plans for this to be merged/released?

ktn00b commented 7 years ago

Facing the same issue with a TypeScript file on windows! Error-

Error calling pygmentize: Error: no lexer for alias 'typescript' found

alyssamichelle commented 7 years ago

I have the same issue: image

here is my computer: image

Any fixes?

alyssamichelle commented 7 years ago

I HAVE A FIX!!!!

Steps

  1. Added TypeScript to the .atom/packages/copy-as-rtf/lib/grammar-mapping.coffee file. image

  2. Added "TypeScript": "TypeScript" to the .atom/packages/copy-as-rtf/node_modules/pygmentize-bundled/vendor/pygments/build-2.7/pygments/lexers/_lassobuiltins.py file image

Now I can copy .ts files as rtf! (I know it is using the js lexer, but for right now that is good enough for me!)


Still not working for you?

I also did these steps before those when trying to fix it. I don't think they are related, but if the above steps don't work for you, you should try these:

  1. ensure you have python on your machine (I use homebrew and already had it installed) http://cl.nicoll.co/kfRW
  2. add a python path to your .bashrc (I use ohmyzsh so I added mine to .zshrc) • If you already have a PATH variable being exported, concat this to what you already have with a : export PATH="$HOME/.rbenv/bin:/usr/local/Cellar/node/5.1.0/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/alyssanicoll/Downloads/mongodb-osx-x86_64-3.2.1/bin:$PATH:/usr/local/bin:/usr/local/lib/python2.7"

• otherwise simply add this line: export PATH="/usr/local/bin:/usr/local/lib/python2.7"

drosenstark commented 7 years ago

I had this problem with gemfile. The answer is to pick one of the values off of the list here. So in my case, I added this line:

"Gemfile": "ruby"

to .atom/packages/copy-as-rtf/lib/grammar-mapping.coffee. This works as ruby is a lexer type, whereas Gemfile is not.