Closed fregante closed 10 years ago
I asked a question in the ST forum about it: http://www.sublimetext.com/forum/viewtopic.php?f=6&t=16470
:+1: Someone answered. In the meanwhile I added some instructions on how to install the GitHub-Flavored Markdown, which is pretty good.
The git hub markdown is cool, did't know about it.
I will try it tomorrow with the suggested sublime.find_resources
.
If I don't have MarkdownEditing installed I still get the error:
Error loading syntax file "Markdown.tmLanguage": Unable to open Markdown.tmLanguage
GhostTest is starting now…
Setting on request handler
SublimeLinter: debug mode: off
HTTP Start
Emmet: No need to update PyV8
found 20 files for base name Main.sublime-menu
Package Control: Skipping automatic upgrade, last run at 2014-07-13 16:14:38, next run at 2014-07-13 17:14:38 or after
focus_sublime_window
WebSocketServer id: 1
Setting on message handler
Setting on close handler
Start
Listening on: 62285
Bind view with id: 34
Setting on message handler
Loading dictionary Packages/Language - English/en_US.dic
error: Error loading syntax file "Markdown.tmLanguage": Unable to open Markdown.tmLanguage
Exception in thread Thread-5:
Traceback (most recent call last):
File "X/threading.py", line 639, in _bootstrap_inner
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/GhostText.py", line 32, in run
self._server.start()
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/WebSocket/WebSocketServer.py", line 84, in start
self._on_message_handler.on_message(self._received_payload)
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/GhostText.py", line 107, in on_message
self._set_syntax_by_host(request['url'], current_view)
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/GhostText.py", line 131, in _set_syntax_by_host
sublime.error_message('Syntax "{}" is not installed!'.format(syntax_part))
UnboundLocalError: local variable 'syntax_part' referenced before assignment
Can you try it again?
Right now no syntax is set at all
I tried with with and without the user setting:
{
"default_syntax": "Packages/MarkdownEditing/Markdown.tmLanguage"
}
I think eventually we'll need some way to match .tmLanguage
files to their "human" name. Let's say the user is editing in ACE editor, we can know for sure what the editor's syntax is set to, but it will be something like javascript
, not Javascript.tmLanguage
.
Right now we might just need a way to guess the best Markdown syntax installed, perhaps by checking for Packages/MarkdownEditing/Markdown.tmLanguage
first and then the generic Markdown.tmLanguage
You have to use Markdown.tmLanguage
or MarkdownEditing/Markdown.tmLanguage
instead of Packages/MarkdownEditing/Markdown.tmLanguage
, sublime.find_resources
matches is a asterisk prefix.
This human name thing would be a big part maintenance, we would have to match "JScript", "JS", "Java Script", "JavaScript"… for only one language.
I used the wrong word, I just meant that if the browser knows the language we need (either by figuring it out or by asking the CodeMirror), it will provide a string like javascript
or text/javascript
, it can't and shouldn't know the exact name of the syntax in the editor.
CodeMirror has a list of the MIMEs we'd need to support anyway: https://github.com/marijnh/CodeMirror/blob/master/mode/javascript/javascript.js#L672
Okey but now we are mixing up the issues, advanced syntax detection can only work if we have https://github.com/Cacodaimon/GhostText-for-Chrome/issues/26 finished and this host name based detection is a way espscially for text areas the only element we are currently supporting.
Back to the topic: Whats the output of the following command in your sublime console.
sublime.find_resources('*Markdown.tmLanguage')
Yeah I only mentioned that name->tmLanguage
matching feature because you're currently working on this tmLanguage setting feature anyway.
>>> sublime.find_resources('*Markdown.tmLanguage')
['Packages/MarkdownEditing/Markdown.tmLanguage', 'Packages/MarkdownEditing/MultiMarkdown.tmLanguage']
Just wanted to report that I am getting the same error message, even with
{
"default_syntax": "MarkdownEditing/Markdown.tmLanguage"
}
set.
Output of sublime.find_resources('*Markdown.tmLanguage')
:
>>> sublime.find_resources('*Markdown.tmLanguage')
['Packages/MarkdownEditing/Markdown.tmLanguage', 'Packages/MarkdownEditing/MultiMarkdown.tmLanguage']
I told crap MarkdownEditing/Markdown.tmLanguage
wont work, but Markdown.tmLanguage
should work:
No extra Markdown installed:
>>> sublime.find_resources('*Markdown.tmLanguage')
['Packages/Markdown/Markdown.tmLanguage', 'Packages/Markdown/MultiMarkdown.tmLanguage']
With MarkdownEditing installed:
>>> sublime.find_resources('*Markdown.tmLanguage')
['Packages/MarkdownEditing/Markdown.tmLanguage', 'Packages/MarkdownEditing/MultiMarkdown.tmLanguage']
This should work, there must be a little bug somewhere, I gonna fix this this evening.
Can someone please check if it works now, if I got an OK I gonna create a new tag.
I get this error, both in the console and as an alert()
, and the syntax is not set
error: Default syntax "Packages/MarkdownEditing/Markdown.tmLanguage" is not installed!
But I can still set it manually, and the path is the same
>>> view.settings().get('syntax')
'Packages/MarkdownEditing/Markdown.tmLanguage'
Can you set your default syntax from
"default_syntax": "Packages/MarkdownEditing/Markdown.tmLanguage",
to
"default_syntax": "Markdown.tmLanguage",
this should match to the right syntax, since the output from find_ressources
was ['Packages/MarkdownEditing/Markdown.tmLanguage', 'Packages/MarkdownEditing/MultiMarkdown.tmLanguage']
on your system…
Cool! It started working after I restarted ST.
The sublime.error_message
should probably be disabled though, especially because it happens at every connection even with the default settings.
Can we make it so it defaults to Markdown if what they specify is not found? If Markdown is not found either it should default to Plain Text. Errors can appear in the console
You are right I gonna change it to your suggested behavior.
Can someone please check if it works now, if I got an OK I gonna create a new tag.
Working fine for me now as well. Great job!
I've had this problem for a while but I just clicked on "Ok" and it didn't appear anymore until I restarted ST. It looks like I don't have that file installed, I just use the MarkdownEditing package, which is pretty good.