Comments (16)
I have currently no idea how to detect a plugin reload…
from ghosttext.
You're right, it's a strange request, can you ask on ST's forum?
from ghosttext.
Yeah I gonna register me there for asking…
from ghosttext.
Found the solution!
If a plugin defines a module level function plugin_loaded(), this will be called when the API is ready to use. Plugins may also define plugin_unloaded(), to get notified just before the plugin is unloaded.
https://www.sublimetext.com/docs/3/api_reference.html
from ghosttext.
This is great! I search this API doc several times and didn't see this 😊
from ghosttext.
Can you check if it works on OS X, too and reopen it if needed.
from ghosttext.
ST start
GhostTest is starting now…
Setting on request handler
HTTP Start
Emmet: No need to update PyV8
no command for selector: noop:
found 21 files for base name Main.sublime-menu
Package Control: Skipping automatic upgrade, last run at 2014-07-12 02:33:05, next run at 2014-07-12 03:33:05 or after
Writing file /Users/bfred/Web/Gitbase/GhostTextForSublimeText/GhostText.py with encoding UTF-8 (atomic)
GhostText.py
file change
reloading plugin GhostText.GhostText
GhostTest is stopping now…
<HttpStatusServerThread(Thread-2, started 4475600896)>
HTTP Stop
Skipped OSError
GhostTest is starting now…
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 115, in reload_plugin
m.plugin_loaded()
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/GhostText.py", line 173, in plugin_loaded
GhostTextGlobals.http_status_server_thread = HttpStatusServerThread(settings)
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/GhostText.py", line 68, in __init__
self._server = HttpServer('localhost', server_port)
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/Http/HttpServer.py", line 13, in __init__
self._socket.bind((host, port))
OSError: [Errno 48] Address already in use
Not working. I tried restarting a couple times but the issue is still there, probably because of that Skipped OSError
from ghosttext.
I don't know what's up… now it's working.
from ghosttext.
I see what happened. It considers FocusSublimeWindow.py
as a plugin on its own, so editing that file doesn't actually reload the whole GT. Editing GhostText.py
on the other hand produces that error above
from ghosttext.
Yes all .py files on the plugin root gets interpreted as a single plugin, FocusSublimeWindow is a mini plugin…
I have added a traceback where the Skipped OSError
message occurs, can you give me the error message since it seems to be a OS X specific error?
from ghosttext.
Here you go
reloading plugin GhostText.GhostText
GhostTest is stopping now…
<HttpStatusServerThread(Thread-1, started 4564324352)>
HTTP Stop
Skipped OSError
[Errno 57] Socket is not connected
Traceback (most recent call last):
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/Http/HttpServer.py", line 43, in stop
self._socket.shutdown(socket.SHUT_RDWR)
OSError: [Errno 57] Socket is not connected
GhostTest is starting now…
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 115, in reload_plugin
m.plugin_loaded()
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/GhostText.py", line 173, in plugin_loaded
GhostTextGlobals.http_status_server_thread = HttpStatusServerThread(settings)
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/GhostText.py", line 68, in __init__
self._server = HttpServer('localhost', server_port)
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/Http/HttpServer.py", line 14, in __init__
self._socket.bind((host, port))
OSError: [Errno 48] Address already in use
from ghosttext.
The Socket is not connected
error should be catched now…
from ghosttext.
I verified that the plugin is actually reloading correctly and the new server code is used: I did so by using a print(2)
in onMessage.on_message
I see these issues though:
Writing file /Users/bfred/Web/Gitbase/GhostText-for-SublimeText/GhostText.py with encoding UTF-8 (atomic)
reloading plugin GhostText.GhostText
GhostTest is stopping now…
<HttpStatusServerThread(Thread-2, started 4461576192)>
HTTP Stop
[Errno 57] Socket is not connected
Traceback (most recent call last):
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/Http/HttpServer.py", line 50, in stop
self._socket.shutdown(socket.SHUT_RDWR)
OSError: [Errno 57] Socket is not connected
HTTP Stopped
GhostTest is starting now…
Setting on request handler
Exception in thread Thread-2:
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 77, in run
raise e
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/GhostText.py", line 74, in run
self._server.start()
File "/Users/bfred/Library/Application Support/Sublime Text 3/Packages/GhostText/Http/HttpServer.py", line 27, in start
self._conn, self._address = self._socket.accept()
File "X/socket.py", line 135, in accept
ConnectionAbortedError: [Errno 53] Software caused connection abort
HTTP Start
from ghosttext.
Cool thanks now I know what went wrong, a little try catch around the socket's accept
should fix it.
from ghosttext.
Try/catch is a quick way to hide the errors but the problems will still be there :D
from ghosttext.
In this case there is no other way to solve it, the accept blocks the thread until a message arrives so there is no way to stop the accept itself. When the connection gets closed the accept fires the exception because it has been closed…
from ghosttext.
Related Issues (20)
- CodeMirror 6 only works on the first connection, then a reload is required
- submit form changes from text editor HOT 2
- textarea modified by javascript HOT 1
- GhostText for input fields HOT 2
- Not Working for Cinny and Element HOT 1
- Support for github.dev and vscode.dev HOT 1
- Doesn't seem to work on StackOverflow.com HOT 11
- is it secure to listen on *:4001 ? HOT 1
- Does it work in codecademy editor? (Monaco editor) HOT 3
- GhostText doesn't work with Monaco editor on CodeSignal
- VS Code Saving clears out textarea HOT 2
- GhostText cannot detect or edit TinyMCE content HOT 3
- Migrate to Manifest V3 HOT 1
- Release version for Safari HOT 1
- After recent upgrade, GhostText disconnects from editor after 30 seconds HOT 13
- The connection to the port is broken. Browser Firefox developer HOT 3
- Disconnected on save HOT 2
- Use node-native WebSocket
- Selected text in the textarea is selected in VS Code, too, but not quite HOT 5
- Content in editor isn't updated when the "Quote reply" button is clicked in GitHub HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ghosttext.