Function: claude-code-ide-mcp--create-lockfile

claude-code-ide-mcp--create-lockfile is a natively compiled function defined in claude-code-ide-mcp.el.

Signature

(claude-code-ide-mcp--create-lockfile PORT PROJECT-DIR)

Documentation

Create a lockfile for PORT with server information for PROJECT-DIR.

Source Code

;; Defined in /nix/store/yjvbhwl7p6zrbw9xlnni7y4hra8sa3pl-emacs-packages-deps/share/emacs/site-lisp/claude-code-ide-mcp.el
(defun claude-code-ide-mcp--create-lockfile (port project-dir)
  "Create a lockfile for PORT with server information for PROJECT-DIR."
  (let* ((lockfile-dir (claude-code-ide-mcp--lockfile-directory))
         (lockfile-path (claude-code-ide-mcp--lockfile-path port))
         (workspace-folders (vector project-dir))
         (lockfile-content `((pid . ,(emacs-pid))
                             (workspaceFolders . ,workspace-folders)
                             (ideName . "Emacs")
                             (transport . "ws"))))
    ;; Ensure directory exists
    (make-directory lockfile-dir t)
    ;; Write lockfile directly without temp file
    (condition-case err
        (with-temp-file lockfile-path
          (insert (json-encode lockfile-content)))
      (error
       (claude-code-ide-debug "Failed to create lockfile: %s" err)
       (signal 'mcp-error (list (format "Failed to create lockfile: %s" (error-message-string err))))))))