;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (defvar omnisharp--server-info nil) (defvar omnisharp--last-project-path nil) (defvar omnisharp--restart-server-on-stop nil) #@40 Set to t to use http instead of stdio. (defvar omnisharp-use-http nil (#$ . 212)) #@29 (fn PROCESS PROJECT-PATH) (defalias 'make-omnisharp--server-info #[514 "\300!\203\n\211\202 \301!\302B\303\304\305\306B\307B\257\207" [f-dir-p f-dirname :process (:request-id . 1) (:response-handlers) (:started\?) :project-path :project-root] 10 (#$ . 300)]) #@292 Attempts to resolve a path to local executable for the omnisharp-roslyn server. Will return `omnisharp-server-executable-path` override if set, otherwise will attempt to use server installed via `omnisharp-install-server`. Failing all that an error message will be shown and nil returned. (defalias 'omnisharp--resolve-omnisharp-server-executable-path #[0 "\203\207\301 \211\203 \207\302\303!\210\302\304!\210\305\207" [omnisharp-server-executable-path omnisharp--server-installation-path message "omnisharp: No omnisharp server could be found." "omnisharp: Please use M-x 'omnisharp-install-server' or download server manually as detailed in https://github.com/OmniSharp/omnisharp-emacs/blob/master/doc/server-installation.md" nil] 3 (#$ . 578)]) #@24 (fn PATH-TO-PROJECT) (defalias 'omnisharp--do-server-start #[257 "\304 \305\306\307\310#!\210\311 \210\312\306\313\"!\210\312\306\314\"!\210\315\316\317\"\210\320\321\320\322\323\211\324\325\326\327\330\331\f!!&\332\333!!\210\334\335\"\210\336\337\"\210)\211\262\"\211\207" [omnisharp--last-project-path omnisharp--restart-server-on-stop process-connection-type omnisharp--server-info omnisharp--resolve-omnisharp-server-executable-path message format "omnisharp: Starting OmniSharpServer using project folder/solution file: %s %s" "(check *omnisharp-log* buffer for omnisharp server log)" omnisharp--log-reset omnisharp--log "Starting OmniSharpServer using project folder/solution file: %s" "Using server binary on %s" save-some-buffers t #[0 "\300\301 !\302\230\207" [file-name-extension buffer-file-name "cs"] 2] nil make-omnisharp--server-info start-process "OmniServer" "--encoding" "utf-8" "--stdio" "-s" omnisharp--path-to-server expand-file-name buffer-disable-undo process-buffer set-process-filter omnisharp--handle-server-message set-process-sentinel #[514 "\303!\304>\205\305\306!\210\307 \205\310\n!\207" [omnisharp--server-info omnisharp--restart-server-on-stop omnisharp--last-project-path process-status (exit signal) message "omnisharp: OmniSharp server terminated" nil omnisharp--do-server-start] 4 "\n\n(fn PROCESS EVENT)"]] 14 (#$ . 1339)]) #@112 For development time cleaning up impossible states of response handlers in the current omnisharp--server-info. (defalias 'omnisharp--clear-response-handlers #[0 "\301\236\302\241\207" [omnisharp--server-info :response-handlers nil] 2 (#$ . 2731)]) #@19 (fn &rest BODY) (defalias 'comment '(macro . #[128 "\300\207" [nil] 2 (#$ . 2986)])) #@225 Sends the given command to the server. Depending on omnisharp-use-http it will either send it via http or stdio. The variable ASYNC has no effect when not using http. (fn API-NAME CONTENTS &optional RESPONSE-HANDLER ASYNC) (defalias 'omnisharp--send-command-to-server #[1026 "\203 \301$\207\302#\207" [omnisharp-use-http omnisharp--send-command-to-server-http omnisharp--send-command-to-server-stdio] 9 (#$ . 3080)]) #@91 Sends the given command via curl (fn API-NAME CONTENTS RESPONSE-HANDLER &optional ASYNC) (defalias 'omnisharp--send-command-to-server-http #[1027 "\300$\207" [omnisharp-post-http-message] 9 (#$ . 3513)]) #@298 Sends the given command to the server and associates a response-handler for it. The server will respond to this request later and the response handler will get called then. Returns the unique request id that the request is given before sending. (fn API-NAME CONTENTS &optional RESPONSE-HANDLER) (defalias 'omnisharp--send-command-to-server-stdio #[770 "\302=\203\n\303\304!\207\305\306\"\204\306P\262\307\236A\310\236A\311# \2037\312\313\314\n\315!$!\210\310\236T\241\210\316\236\317\206I\320BC\316\236A\"\241\210\321\322!\323P\"\210\207" [omnisharp--server-info omnisharp-debug nil message "omnisharp: OmniSharp server not running. Start it with `omnisharp-start-omnisharp-server' first" s-starts-with\? "/" :process :request-id omnisharp--make-request-packet omnisharp--log format "--> %s %s %s" prin1-to-string :response-handlers -concat identity process-send-string json-encode "\n"] 14 (#$ . 3729)]) #@117 Like `omnisharp--send-command-to-server' but will block until the request responded by the server. (fn &rest ARGS) (defalias 'omnisharp--send-command-to-server-sync #[128 "\300\301\302\"!\207" [omnisharp--wait-until-request-completed apply omnisharp--send-command-to-server] 5 (#$ . 4675)]) #@37 (fn API-NAME CONTENTS REQUEST-ID) (defalias 'omnisharp--make-request-packet #[771 "\300\301BC\302B\303BD\"\207" [-concat Arguments Command Seq] 8 (#$ . 4974)]) #@138 Parse alists from accumulated json responses in the server's process buffer, and handle them as server events (fn PROCESS MESSAGE-PART) (defalias 'omnisharp--handle-server-message #[514 "\3001\301\"\302\303\304\305\"\"\306\307\"\266\2030\207\310\311\312!\"\313!\210\314!\207" [(error) omnisharp--read-lines-from-process-output "The server sent an unknown json message. Inspect the omnisharp-server process buffer to view recent messages from the server. Set `omnisharp-debug' to t and inspect the *omnisharp-debug* buffer for this error specifically." mapcar make-closure #[257 "\301\300\"\207" [V0 omnisharp--json-read-from-string] 4 "\n\n(fn IT)"] -map omnisharp--handle-server-event format "omnisharp--handle-server-message error: %s. See the OmniServer process buffer for detailed server output." prin1-to-string omnisharp--log message] 8 (#$ . 5146)]) #@15 (fn PACKET) (defalias 'omnisharp--log-packet\? #[257 "\300\236A\301\232\205\302\236A\303\232\207" [Type "event" Event "log"] 3 (#$ . 6021)]) #@15 (fn PACKET) (defalias 'omnisharp--log-log-packet #[257 "\300\236A\301\236A\302\236A\303\236A\304\305\306$!\210\307\230\205&\310\305\311#!\207" [Body LogLevel Name Message omnisharp--log format "%s: %s, %s" "OmniSharp.Startup" message "omnisharp: %s, %s"] 11 (#$ . 6174)]) #@15 (fn PACKET) (defalias 'omnisharp--event-packet\? #[257 "\300\236A\301\232\207" [Type "event"] 3 (#$ . 6465)]) #@15 (fn PACKET) (defalias 'omnisharp--response-packet\? #[257 "\300\236A\301\232\207" [Type "response"] 3 (#$ . 6584)]) #@15 (fn PACKET) (defalias 'omnisharp--ignorable-packet\? #[257 "\300\236\205 \301\236\207" [Arguments Command] 3 (#$ . 6709)]) #@15 (fn PACKET) (defalias 'omnisharp--handle-event-packet #[257 "\301\211\211\262\242\301\302\236A\210\303\236A\301\304\305\"\203\301\207\306\232\205-\307\310!\210\311\312!\210\313\236\314\241\207" [server-info nil Type Event -contains\? ("ProjectAdded" "ProjectChanged") "started" omnisharp--log "The server has started" message "The OmniSharp server is ready. Hacks and glory await!" :started\? t] 9 (#$ . 6843)]) #@148 Takes an alist representing some kind of Packet, possibly a ResponsePacket or an EventPacket, and processes it depending on its type. (fn PACKET) (defalias 'omnisharp--handle-server-event #[257 "\301!\203 \302\207\303!\203\304\"\207\305!\203\306!\207\307!\203(\310!\207\311\312\313\314!\"!\207" [omnisharp--server-info omnisharp--ignorable-packet\? nil omnisharp--response-packet\? omnisharp--handle-server-response-packet omnisharp--log-packet\? omnisharp--log-log-packet omnisharp--event-packet\? omnisharp--handle-event-packet omnisharp--log format "<-- Received an unknown server packet: %s" prin1-to-string] 7 (#$ . 7273)]) #@31 (fn SERVER-INFO REQUEST-ID) (defalias 'omnisharp--remove-response-handler #[514 "\300\236\301\302\300\236A!\303\301\211\2030\211A\262\242\262\262T\262@U\204 B\262\202 \266\211\237\262\241\207" [:response-handlers nil -non-nil 0] 10 (#$ . 7925)]) #@90 Calls the appropriate response callback for the received packet (fn PACKET SERVER-INFO) (defalias 'omnisharp--handle-server-response-packet #[514 "\300\301\236A\210\302\236A\303\236A\304\236A\305\236A\306\236A\300\307\300\211\211\203V\211A\262\242\262\262\211\262\203V@U\203I\300\262\203V\262\262T\262\202$\266\211\262\211\203\276\211\211\211A\262\242\3101\242\311\312=\203\201\313\314\f\315!$\202\213\313\316\f\315!$!\210\317\"\210\320=\205\240\321 C\"0\207\313\322\315!\315!\315!$\311!\210\317\"\210\323!\207\311\313\324\n$!\207" [nil Message Body Command Success Request_seq :response-handlers 0 (error) omnisharp--log :json-false format "<-- %s %s: request failed" prin1-to-string "<-- %s %s: %s" omnisharp--remove-response-handler t apply "\nomnisharp--handle-server-response-packet error: \n%s.\n\nTried to handle this packet: \n%s\n\nThis can mean an error in the handler function:\n%s\n\n" message "<-- %s %s: Warning: internal error - response has no handler: %s"] 22 (#$ . 8200)]) (defalias 'omnisharp--at-full-line\? #[0 "\300\301\302\303\304!\206\n\305!\"\207" [s-ends-with\? "\n" substring-no-properties thing-at-point line ""] 5]) #@27 (fn POSITION-OR-MARKER) (defalias 'omnisharp--marker-at-full-line\? #[257 "\212\211b\210\300 )\207" [omnisharp--at-full-line\?] 2 (#$ . 9429)]) #@372 Problem: emacs reads output from the omnisharp-roslyn subprocess not line by line, but by some amount of characters. The way we want to read the omnisharp-roslyn output is line by line, since each response seems to be exactly one line long. This function returns full lines returned from the server process that have not been returned before. (fn PROCESS MESSAGE-PART) (defalias 'omnisharp--read-lines-from-process-output #[514 "\301\302!!\205vr\302!q\210\212\303!b\210`)\304\305!b\210c\210\306`!\205s\303!`\307\223\210\211b\210\310 \210\311\312`\303!\"!\313\204B\314 \210\315\307\316\307\211\203j\211A\262\242\262\262T\262\317!\204IB\262\202I\266\211\237\262\"\266\202\262)\207" [omnisharp-debug buffer-live-p process-buffer process-mark buffer-end 1 omnisharp--marker-at-full-line\? nil beginning-of-line s-lines buffer-substring-no-properties #[257 "\300\301\300\301\"\"\207" [string-remove-prefix ""] 6 "\n\n(fn S)"] erase-buffer -map 0 s-blank\?] 14 (#$ . 9582)]) #@102 Checks if the server for the project of the buffer is running and attempts to start it if it is not. (defalias 'omnisharp--attempt-to-start-server-for-buffer #[0 "\301 \206\302 ??\205\202\302 \205\303\236A\211\205\"\304\305D!\"\306 \307\310\"G\311U\2034@\202=\211G\311U\205=\211@\204I\211\203I\312!\207\204nG\311U\204n\313\314!\210G\315U?\205\200\313\316\317\320\"P!\210\313\321!\207\205\200?\205\200\313\322\323#!\266\206\207" [omnisharp--server-info omnisharp--buffer-contains-metadata buffer-file-name :project-root f-same-p f-common-parent omnisharp--resolve-sln-candidates -filter #[257 "\300!\301\230\207" [f-ext "sln"] 3 "\n\n(fn FILENAME)"] 1 omnisharp--do-server-start message "omnisharp: no unambigious project path could be found to start OmniSharp server for this buffer automatically" 0 "omnisharp: project path candidates are: " s-join ", " "omnisharp: start the server manually with M-x omnisharp-start-omnisharp-server" format "omnisharp: buffer will not be managed by omnisharp: %s is outside the root directory of the project loaded on the current OmniSharp server: %s"] 11 (#$ . 10595)]) (provide 'omnisharp-server-management)