Open XanderXAJ opened 7 years ago
I forked it to test a change I found on another package and it works.
// -
editor.getCommentStrings(scope)
// +
editor.getScopedSettingsDelegate().getCommentStrings(scope)
I just Googled the error and plopped in the change from
nteract/hydrogen
. I haven't spent enough time tinkering with Atom packages to know about the API and how it'll affect each version. I just had a free moment to tinker with this line and test on my machine.
I don't think it's enough to warrant a PR since I didn't do testing for older Atom versions and it's such a small change.
This fix worked for me. It looks like the author isn't paying attention or has abandoned this project...? - @danielhickman maybe you should go ahead and submit a pull request to try and get their attention.
@pcdgroup I'm sure he's just busy but I'll go ahead and submit a PR, but discussion will probably need to take place there about how to move forward with support for older versions.
Done > #10.
I overwrote my existing test commit with a simple check for the function as the previous did. This should still support the older versions I can't test due to the time it takes to use multiple instances of Atom since I'm [again] unfamiliar with Atom's core.
Sorry, my mistake: just created a new issue #11 that's actually only related to #10.
I don't know if I do it well, first time I comment on this website. But no one of your correction work on my Atom version (1.25.0).
This is what I do to correct it :
//68 //- {commentStartString, commentEndString} = editor.languageMode.commentStartAndEndStringsForScope?(scope) ? editor.getCommentStrings(scope) //68 //+ {commentStartString, commentEndString} = editor.languageMode.commentStartAndEndStringsForScope?(scope) ? editor.tokenizedBuffer.commentStringsForPosition(editor.getCursorBufferPosition())
Find here : https://github.com/nteract/hydrogen/pull/1147/files
Sorry for bad English but I hope this can help.
This is my hack to overcome identification of commented strings (only for //
and #
, add others in the array if needed)
Replace this:
(lines 69 to 79 in .atom\packages\figlet\lib\figlet.coffee
)
{commentStartString, commentEndString} = editor.languageMode.commentStartAndEndStringsForScope?(scope) ? editor.getCommentStrings(scope)
if commentStartString?
commentStartRegexString = escapeRegExp(commentStartString).replace(/(\s+)$/, '')
commentStartRegex = new RegExp("^(\\s*)(#{commentStartRegexString})*\\s+")
match = commentStartRegex.exec(selectionText)
if match?
{length} = match[0]
start.column += length
selectionText = selectionText[length..-1]
with this:
for key in ['//', '#']
commentStartRegexString = escapeRegExp(key)
commentStartRegex = new RegExp("^(\\s*)(#{commentStartRegexString})*\\s+")
match = commentStartRegex.exec(selectionText)
if match?
{length} = match[0]
start.column += length
selectionText = selectionText[length..-1]
Ok, now it does not support anymore the keystroke ctrl-alt-shift-F for the command figlet:convert-last Now i used another package with minimap and it works perfectly. This one is out of date.
Hm...
I have the latest (1.40.1 x64 Windows based) version of Atom and just now tried the ctrl-alt-shift-F and it still works as usual. I have tried your suggested package, the minimap-titles, but it clashes with some another package and attempts to create a block comment:
/**
* Block comment
*
* @param type
* @return void
██ ██ ███████ ██ ██ ██████ ██ ██ ██████ ██████ ██ ██████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ █████ ██ ██ ██ ██ ██ █ ██ ██ ██ ██████ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ███████ ███████ ███████ ██████ ███ ███ ██████ ██ ██ ███████ ██████
*/
Then, the package lacks a interface to choose fonts (you have to set your ASCI font through the config file).
@stanmarc your solution worked for me, (including the ctrl-alt-f command), thanks!
Steps to reproduce:
The error is thrown immediately. I assume it's because APIs have changed in newer Atom versions.
Atom: 1.23.0-beta1 x64 Electron: 1.6.15 OS: Mac OS X 10.13.1 Thrown From: figlet package 0.5.4
Stack Trace
Uncaught TypeError: editor.getCommentStrings is not a function
Commands
Non-Core Packages