-
Notifications
You must be signed in to change notification settings - Fork 6
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
add windows support #4
Comments
I can get notifications for issues / repos without having to reply to it (see "Notifications for new comments on this Issue are on/off." below) btw. Anyway, reference link. |
It should be possible to add Windows support based on maComfort. Could you install maComfort version 1.5 or later (available at http://rafaelklaus.com/macomfort/) and try a couple of python commands?
|
Works pretty well. Except that it does not display CSS
But really, I scanned your code a bit. (Besides some really odd bits of code) it seems that your only real problem here is that you use a Mac OS-internal method for displaying an HTML file; and that distutils. There are a hundret ways of doing so, the easiest would be to just ShellExecute them and let Windows take care of running the associated application (FireFox in my case). Anyway, what I'm saying is: Don't use maComfort. Don't force Windows users to install an application they probably don't like (well, I don't) just for this purpose. Imagine how someone using Linux would react to that. |
Besides, if your generated HTML is not special or can be conveyed in textform just as well (I don't know), you could also use a sublime-internal output panel (and maybe set an invisible syntax to it if there are patterns). |
So the syntax to ShellExecute would be ps: I am not very experienced with Python so feel free to point out 'bad' code. On May 12, 2012, at 7:12 PM, FichteFoll wrote:
|
or
But note that these functions return immediately and do not return any object for threading or whatsoever. I would consider forking and making a pull request by myself but unfortunately I don't really have the time for that. |
So I assume |
No, I'm afraid.
Translates to "Access denied". |
The dev branch now contains a version with initial windows and linux support. Windows support is based on |
Some notes:
And there is a problem with distutils on Windows. I don't yet understand distutils's purpose and what it does but it fails to load on my machine.
See also SublimeText/PackageDev#7 |
okay, I am now using |
Well, nothing worked at all. I did some debugging and I was rather surprised at what level your plugin was failing.
Then, I don't have Generating PHP doc worked for a while, then I got
There are some helpfiles in the directory but sadly clicking their links does not work because they have a different naming scheme than they are named, actually. Btw I tried importing pydoc but this seems to be rather ... odd and behaves somewhat weird. But you might want to check it out at least, that would not require any cmd line call for Python help. Source: http://hg.python.org/cpython/file/2.6/Lib/pydoc.py |
okay, I fixed most of these problems. For pydoc, I have added a setting I am not sure what you mean with "modifying the self.path variable does not seem to work that well with Python syntax". For python, self.path simply sets the location where the help files are temporarily saved. The PHP problem seems to be related to invalid filenames on windows. E.g. I never tried to make the links in the help files work. I have added a ticket ( #15) for that but I probably won't get into it right now. |
Any opinion about encoding the filenames like this? The files itself would not be human readability though.
here is the output from the last two lines: |
I mean that the files generated by Regarding the filenames: Try just replacing invalid characters (with like |
just a quick update: I did some changes in the background for the filename stuff but now have to finish up some other stuff and will get back to this in a while... |
Heyo, i too would love windows support, and i see progress is being made. Very awesome! So far I've simply installed the package via package control. I assume then keymap to get this going is "windowskey+shift+h"? I'm assuming that "super" could mean either the apple key for apple and the windows key for windows. I tried changing this to something simple like "f2" just to get it to work the first time, and nothing happened. I modified the Default (OSX).sublime-keymap file to read [ Restarted sublime text and still didn't get the help to show up. I figured now that the problem isn't the key binding, but something else. Then i read the above post from FichteFoll about the pydoc command not being in the path setting in windows. I see you've updated so users can configure the path to this command, but I don't know where to put it. I tried putting it into the location that you referenced "Pref.->Package Settings...." in the "Settings - Default" file, but kept getting a syntax error. Not sure what the proper syntax is, or if i'm even in the right spot. My google searches are coming up with some sort of Python.settings file maybe. But I'm not sure. Figure i better ask for some help :) Any help would be appreciated. Looking forward to using this package with Sublime Text 2 |
Okay, i'm moving closer to getting this working. I found your dev branch and installed it instead of the one from the master. Now i have the work that you've done so far to get windows supported. Right now i'm in the process of downloading the dev version of Sublime Text 2 so i can get around my issue with 'module' object has no attribute 'ok_cancel_dialog'. |
All right, seems to be working okay now. I'm sure i'm at the same point now as FichteFoll. I'll be keeping an eye for when this is "officially" released. Thanks for all your hard work. This is really sweet! :D |
good that you managed to run it! Maybe you can provide a short description of the steps (excluding the dev branch stuff) so that I could put that in the readme? |
Sure, until you release these changes to master people will want to start off by grabbing it from your dev branch https://github.com/jlegewie/SublimePeek/tree/dev After that they'll want to make sure they have Sublime Text 2 build 2187 or later. at the time i wrote this the latest stable version was 2181. See this thread for why: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=7031 For me after i did those two things, i was able to use SublimePeek. Maybe pydoc was already in my path folder on my system. I didn't have to do anything. I think i had to get the python dll in my path folder for WinCVS and Mercurial migration plugin that i did a while ago. Seems css and javascript are not working though. I'm getting the following errors in the console for Sublime Text 2 Traceback (most recent call last): and Traceback (most recent call last): Seems to be related to the path thing that was mentioned above? |
Ahh i see what happened with the generated help files for javascript. It's trying to find C:\Users\cmartin\AppData\Roaming\Sublime Text 2\Packages\SublimePeek-JavaScript-help\JavaScript-mapping.json, but on my system the .json file is at: C:\Users\cmartin\AppData\Roaming\Sublime Text 2\Packages\SublimePeek-JavaScript-helpJavaScript-mapping.json Seems there was a missing concatenation of the '' character when building out the JavaScript-mapping.json file Still now sure about the css error though |
I fixed that particular problem (untested but it should work). So you can reinstall the dev branch version and try again. Note that you have to delete the |
The fix you applied was for when Python help files were generated. I made your changes for javascript generation and received this error: IOError: [Errno 2] No such file or directory: u'C:\Users\cmartin\AppData\Roaming\Sublime Text 2\Packages\SublimePeek-JavaScript-help\JavaScript-mapping.json\w' I noted a missplaced parenthesis, so i changed the line 567 to read: f_map = open(os.path.join(self.path, "JavaScript-mapping.json"), "w") And it's working great now. Still having issues with css though. Seems it's not generating the whole html set. The error is while it's generating the html when it's trying to build the file for the background-clip attribute. |
and fixed my css issue too. You had starting at line 550 #filename_valid = re.sub(r"[\\/:\"*?<>|]+", "", id)
f = open(os.path.join(self.path, id + ".html"), "w")
f.write((html_page % (id, id, html, note_content)).encode('utf-8'))
f.close() So i changed it to: filename_valid = re.sub(r"[\\/:\"*?<>|]+", "", id)
f = open(os.path.join(self.path, filename_valid + ".html"), "w")
f.write((html_page % (id, id, html, note_content)).encode('utf-8'))
f.close() And that gave me the ability to generate the html file for "background-clip | -mox-backround-clip" attribute. I suspect this code might still be experimental so I've reverted it after getting the full set of css html files :) Now i'm not a python developer so I tried to generate the help files for that language as well. Ran into this error:
|
Couple of comments:
|
Yeah, I noted that as well. I just ended up taking the one generated html file "background-clip -moz-background-clip.html" and copying it to two html files. One "background-clip.html" and the other "-moz-background-clip.html". Now i'm able to find either attribute For the python help generation, that makes sense. So i suppose my pydoc is not setup right. When i try to use the suggested setting i get a parse error when i save the settings file. |
Okay, here's what i've found for Python for windows I tried this setting: "pydoc_call":["C:\\Python27\\Lib\\pydoc.py", "-w"], But then i'd end up getting the following error:
So based on the suggested I ended up using the following which started to make some progress "pydoc_call":["C:\\Python27\\python","C:\\Python27\\Lib\\pydoc.py", "-w"], Now i get a popup window with html that only contains the keyword. it doesn't have any "content". So i started to dig a little I noted we'd fall into this condition check in python due to the bug of 'no Python documentation found for' because of the '-w' switch. starting at line 256: if 'no Python documentation found for' in output:
output = subprocess.Popen([args[0], keyword], stdout=subprocess.PIPE).communicate()[0]
# exit if no help found
if 'no Python documentation found for' in output:
return keyword
# write html file
output = output.replace('\n', '<br>').replace(' ', ' ')
write_html_file(keyword, keyword, output, 'python')
return keyword I noted that subprocess.Popen was being called with only the first value out of the new pdoc_call setting. So in my case it'd call Python.exe and it'd pass the keyword as an argument. Of course we were expecting to be passing the keyword to pydoc.py. So when i changed the script to this: if 'no Python documentation found for' in output:
output = subprocess.Popen([args[0], args[1], keyword], stdout=subprocess.PIPE).communicate()[0]
# exit if no help found
if 'no Python documentation found for' in output:
return keyword
# write html file
output = output.replace('\n', '<br>').replace(' ', ' ')
write_html_file(keyword, keyword, output, 'python')
return keyword Of course this does mean that i've now broken it for compatibility for mac, as in that environment we're only expecting to have two values for the pydoc_call setting. Not sure how to get all values out of a python array except the value that is "-w" So right now I am getting python documentation to popup. Maybe using this pandoc thing might be the better option for windows users? Not sure what to set |
I'm not sure I understand why Windows support requires maComfort; so I'm not sure if my enhancement request to support Windows without maComfort needs to be entered as a separate issue or not. I have a windows machine at work on which I may be able to to implement this. What is needed? |
The maComfort thing is a little outdated. If you are on ST3, SublimePeek might already work. Just give it a try and let me know how it goes. I think PHP makes problems but the other languages work. But I am not sure... |
I'm interested in having this under windows too! I think this is a great plugin and I miss having documentation inside the IDE, compared to other IDES this bridges that batch very nicely! I see these comments are a bit old. Are you interested in rekindeling this? I ran it on windows using st3 and it runs, partially:
Any suggestions? |
I am not going to put any major work into this right now but I am happy when others send pull requests.
|
Thanks! Now I see it inside ST, this is awesome! Is there any chance you can provide any feedback on what could be causing the error above? Or maybe you can post a compiled php doc as you did for "R"? Or I could try and build it myself externally but it looks like the compiler doesn't work ok on windows. |
There is some discussion about that problem in earlier posts in the threat. Windows is not happy with the filename |
Ok, thanks man. I'll post here if I make any progress |
cmartinfosol's fix worked for fixing the help file compile error. May 22, 2012. I understand it's not a good idea because those help files won't be found, but at least I get most of the functions I normally use documented. |
sublime.platform(): Returns the platform, which may be "osx", "linux" or "windows"
The text was updated successfully, but these errors were encountered: