RefactoringRope/Documentation/source/Plugin_Refactoring_Rope.RefactoringRope.CodeAssistServer.html

Sun, 13 Oct 2024 15:49:43 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 13 Oct 2024 15:49:43 +0200
branch
eric7
changeset 416
45159308166f
parent 414
af1d72eccf91
permissions
-rw-r--r--

Fixed an issue related to 'eric-ide' server use.

<!DOCTYPE html>
<html><head>
<title>Plugin_Refactoring_Rope.RefactoringRope.CodeAssistServer</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<a NAME="top" ID="top"></a>
<h1>Plugin_Refactoring_Rope.RefactoringRope.CodeAssistServer</h1>
<p>
Module implementing the autocompletion interface to rope.
</p>

<h3>Global Attributes</h3>
<table>
<tr><td>PictureIDs</td></tr>
</table>

<h3>Classes</h3>
<table>
<tr>
<td><a href="#CodeAssistServer">CodeAssistServer</a></td>
<td>Class implementing the autocompletion interface to rope.</td>
</tr>
</table>

<h3>Functions</h3>
<table>
<tr><td>None</td></tr>
</table>

<hr />
<hr />
<a NAME="CodeAssistServer" ID="CodeAssistServer"></a>
<h2>CodeAssistServer</h2>
<p>
    Class implementing the autocompletion interface to rope.
</p>

<h3>Derived from</h3>
EricJsonServer
<h3>Class Attributes</h3>
<table>
<tr><td>IdProject</td></tr>
</table>

<h3>Class Methods</h3>
<table>
<tr><td>None</td></tr>
</table>

<h3>Methods</h3>
<table>
<tr>
<td><a href="#CodeAssistServer.__init__">CodeAssistServer</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__configChanged">__configChanged</a></td>
<td>Private slot called, when the rope config file has changed.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__ensureActive">__ensureActive</a></td>
<td>Private method to ensure, that the requested client is active.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__getConfigs">__getConfigs</a></td>
<td>Private method to get the configurations of all connected clients.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__gotoDefinitionResult">__gotoDefinitionResult</a></td>
<td>Private method to handle the "Goto Definition" result sent by the client.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__idString">__idString</a></td>
<td>Private method to determine the ID string for the back-end.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__interpreterForProject">__interpreterForProject</a></td>
<td>Private method to determine the interpreter for the current project and the environment to run it.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__processCallTipsResult">__processCallTipsResult</a></td>
<td>Private method to process the calltips sent by the client.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__processClientException">__processClientException</a></td>
<td>Private method to handle exceptions of the refactoring client.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__processCompletionsResult">__processCompletionsResult</a></td>
<td>Private method to process the completions sent by the client.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__processDocumentationResult">__processDocumentationResult</a></td>
<td>Private method to process the documentation sent by the client.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__processGotoReferencesResult">__processGotoReferencesResult</a></td>
<td>Private method callback for the goto references result.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__projectClosed">__projectClosed</a></td>
<td>Private slot to handle the projectClosed signal.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__ropeConfigFile">__ropeConfigFile</a></td>
<td>Private method to get the name of the rope configuration file.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__setConfig">__setConfig</a></td>
<td>Private method to set the rope client configuration data.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__startCodeAssistClient">__startCodeAssistClient</a></td>
<td>Private method to start the code assist client with the given interpreter.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.__updateEditorLanguageMapping">__updateEditorLanguageMapping</a></td>
<td>Private method to update the editor language to connection mapping.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.activate">activate</a></td>
<td>Public method to activate the code assist server.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.createConfig">createConfig</a></td>
<td>Public slot to create a new default rope configuration file.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.deactivate">deactivate</a></td>
<td>Public method to deactivate the code assist server.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.editConfig">editConfig</a></td>
<td>Public slot to open the rope configuration file in an editor.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.getCallTips">getCallTips</a></td>
<td>Public method to calculate calltips.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.gotoDefinition">gotoDefinition</a></td>
<td>Public slot to find the definition for the word at the cursor position and go to it.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.handleCall">handleCall</a></td>
<td>Public method to handle a method call from the client.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.handleNewConnection">handleNewConnection</a></td>
<td>Public slot for new incoming connections from a client.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.isSupportedLanguage">isSupportedLanguage</a></td>
<td>Public method to check, if the given language is supported.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.reportChanged">reportChanged</a></td>
<td>Public slot to report some changed sources.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.requestCodeDocumentation">requestCodeDocumentation</a></td>
<td>Public method to request source code documentation for the given editor.</td>
</tr>
<tr>
<td><a href="#CodeAssistServer.requestCompletions">requestCompletions</a></td>
<td>Public method to request a list of possible completions.</td>
</tr>
</table>

<h3>Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>


<a NAME="CodeAssistServer.__init__" ID="CodeAssistServer.__init__"></a>
<h4>CodeAssistServer (Constructor)</h4>
<b>CodeAssistServer</b>(<i>plugin, parent=None</i>)
<p>
        Constructor
</p>

<dl>

<dt><i>plugin</i> (RefactoringRopePlugin)</dt>
<dd>
reference to the plugin object
</dd>
<dt><i>parent</i> (QObject)</dt>
<dd>
parent
</dd>
</dl>
<a NAME="CodeAssistServer.__configChanged" ID="CodeAssistServer.__configChanged"></a>
<h4>CodeAssistServer.__configChanged</h4>
<b>__configChanged</b>(<i>idString</i>)
<p>
        Private slot called, when the rope config file has changed.
</p>

<dl>

<dt><i>idString</i> (str)</dt>
<dd>
id for which to get the configuration file
</dd>
</dl>
<a NAME="CodeAssistServer.__ensureActive" ID="CodeAssistServer.__ensureActive"></a>
<h4>CodeAssistServer.__ensureActive</h4>
<b>__ensureActive</b>(<i>idString</i>)
<p>
        Private method to ensure, that the requested client is active.
</p>
<p>
        A non-active client will be started.
</p>

<dl>

<dt><i>idString</i> (str)</dt>
<dd>
id of the client to be checked
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating an active client
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="CodeAssistServer.__getConfigs" ID="CodeAssistServer.__getConfigs"></a>
<h4>CodeAssistServer.__getConfigs</h4>
<b>__getConfigs</b>(<i></i>)
<p>
        Private method to get the configurations of all connected clients.
</p>

<a NAME="CodeAssistServer.__gotoDefinitionResult" ID="CodeAssistServer.__gotoDefinitionResult"></a>
<h4>CodeAssistServer.__gotoDefinitionResult</h4>
<b>__gotoDefinitionResult</b>(<i>result</i>)
<p>
        Private method to handle the "Goto Definition" result sent by
        the client.
</p>

<dl>

<dt><i>result</i> (dict)</dt>
<dd>
dictionary containing the result data
</dd>
</dl>
<a NAME="CodeAssistServer.__idString" ID="CodeAssistServer.__idString"></a>
<h4>CodeAssistServer.__idString</h4>
<b>__idString</b>(<i>editor</i>)
<p>
        Private method to determine the ID string for the back-end.
</p>

<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor to determine the ID string for
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
ID string
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
str
</dd>
</dl>
<a NAME="CodeAssistServer.__interpreterForProject" ID="CodeAssistServer.__interpreterForProject"></a>
<h4>CodeAssistServer.__interpreterForProject</h4>
<b>__interpreterForProject</b>(<i></i>)
<p>
        Private method to determine the interpreter for the current project and
        the environment to run it.
</p>

<dl>
<dt>Return:</dt>
<dd>
tuple containing the interpreter of the current project and the
            environment variables
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
tuple of (str, dict)
</dd>
</dl>
<a NAME="CodeAssistServer.__processCallTipsResult" ID="CodeAssistServer.__processCallTipsResult"></a>
<h4>CodeAssistServer.__processCallTipsResult</h4>
<b>__processCallTipsResult</b>(<i>result</i>)
<p>
        Private method to process the calltips sent by the client.
</p>

<dl>

<dt><i>result</i> (dict)</dt>
<dd>
dictionary containing the result sent by the client
</dd>
</dl>
<a NAME="CodeAssistServer.__processClientException" ID="CodeAssistServer.__processClientException"></a>
<h4>CodeAssistServer.__processClientException</h4>
<b>__processClientException</b>(<i>params</i>)
<p>
        Private method to handle exceptions of the refactoring client.
</p>

<dl>

<dt><i>params</i> (dict)</dt>
<dd>
dictionary containing the exception data
</dd>
</dl>
<a NAME="CodeAssistServer.__processCompletionsResult" ID="CodeAssistServer.__processCompletionsResult"></a>
<h4>CodeAssistServer.__processCompletionsResult</h4>
<b>__processCompletionsResult</b>(<i>result</i>)
<p>
        Private method to process the completions sent by the client.
</p>

<dl>

<dt><i>result</i> (dict)</dt>
<dd>
dictionary containing the result sent by the client
</dd>
</dl>
<a NAME="CodeAssistServer.__processDocumentationResult" ID="CodeAssistServer.__processDocumentationResult"></a>
<h4>CodeAssistServer.__processDocumentationResult</h4>
<b>__processDocumentationResult</b>(<i>result</i>)
<p>
        Private method to process the documentation sent by the client.
</p>

<dl>

<dt><i>result</i> (dict with keys 'name', 'argspec', 'note', 'docstring', 'typ')</dt>
<dd>
dictionary containing the result sent by the client
</dd>
</dl>
<a NAME="CodeAssistServer.__processGotoReferencesResult" ID="CodeAssistServer.__processGotoReferencesResult"></a>
<h4>CodeAssistServer.__processGotoReferencesResult</h4>
<b>__processGotoReferencesResult</b>(<i>result</i>)
<p>
        Private method callback for the goto references result.
</p>

<dl>

<dt><i>result</i> (dict)</dt>
<dd>
dictionary containing the result data
</dd>
</dl>
<a NAME="CodeAssistServer.__projectClosed" ID="CodeAssistServer.__projectClosed"></a>
<h4>CodeAssistServer.__projectClosed</h4>
<b>__projectClosed</b>(<i></i>)
<p>
        Private slot to handle the projectClosed signal.
</p>

<a NAME="CodeAssistServer.__ropeConfigFile" ID="CodeAssistServer.__ropeConfigFile"></a>
<h4>CodeAssistServer.__ropeConfigFile</h4>
<b>__ropeConfigFile</b>(<i>idString</i>)
<p>
        Private method to get the name of the rope configuration file.
</p>

<dl>

<dt><i>idString</i> (str)</dt>
<dd>
id for which to get the configuration file
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
name of the rope configuration file
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
str
</dd>
</dl>
<a NAME="CodeAssistServer.__setConfig" ID="CodeAssistServer.__setConfig"></a>
<h4>CodeAssistServer.__setConfig</h4>
<b>__setConfig</b>(<i>params</i>)
<p>
        Private method to set the rope client configuration data.
</p>

<dl>

<dt><i>params</i> (dict)</dt>
<dd>
dictionary containing the configuration data
</dd>
</dl>
<a NAME="CodeAssistServer.__startCodeAssistClient" ID="CodeAssistServer.__startCodeAssistClient"></a>
<h4>CodeAssistServer.__startCodeAssistClient</h4>
<b>__startCodeAssistClient</b>(<i>interpreter, idString, clientEnv</i>)
<p>
        Private method to start the code assist client with the given
        interpreter.
</p>

<dl>

<dt><i>interpreter</i> (str)</dt>
<dd>
interpreter to be used for the code assist client
</dd>
<dt><i>idString</i> (str)</dt>
<dd>
id of the client to be started
</dd>
<dt><i>clientEnv</i> (dict)</dt>
<dd>
dictionary with environment variables to run the
            interpreter with
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating a successful start of the client
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="CodeAssistServer.__updateEditorLanguageMapping" ID="CodeAssistServer.__updateEditorLanguageMapping"></a>
<h4>CodeAssistServer.__updateEditorLanguageMapping</h4>
<b>__updateEditorLanguageMapping</b>(<i></i>)
<p>
        Private method to update the editor language to connection mapping.
</p>

<a NAME="CodeAssistServer.activate" ID="CodeAssistServer.activate"></a>
<h4>CodeAssistServer.activate</h4>
<b>activate</b>(<i></i>)
<p>
        Public method to activate the code assist server.
</p>

<a NAME="CodeAssistServer.createConfig" ID="CodeAssistServer.createConfig"></a>
<h4>CodeAssistServer.createConfig</h4>
<b>createConfig</b>(<i>idString</i>)
<p>
        Public slot to create a new default rope configuration file.
</p>

<dl>

<dt><i>idString</i> (str)</dt>
<dd>
id for which to create the configuration file
</dd>
</dl>
<a NAME="CodeAssistServer.deactivate" ID="CodeAssistServer.deactivate"></a>
<h4>CodeAssistServer.deactivate</h4>
<b>deactivate</b>(<i></i>)
<p>
        Public method to deactivate the code assist server.
</p>

<a NAME="CodeAssistServer.editConfig" ID="CodeAssistServer.editConfig"></a>
<h4>CodeAssistServer.editConfig</h4>
<b>editConfig</b>(<i>idString</i>)
<p>
        Public slot to open the rope configuration file in an editor.
</p>

<dl>

<dt><i>idString</i> (str)</dt>
<dd>
id for which to get the configuration file
</dd>
</dl>
<a NAME="CodeAssistServer.getCallTips" ID="CodeAssistServer.getCallTips"></a>
<h4>CodeAssistServer.getCallTips</h4>
<b>getCallTips</b>(<i>editor, pos, commas</i>)
<p>
        Public method to calculate calltips.
</p>

<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor object, that called this method
</dd>
<dt><i>pos</i> (int)</dt>
<dd>
position in the text for the calltip
</dd>
<dt><i>commas</i> (int)</dt>
<dd>
minimum number of commas contained in the calltip
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
list of possible calltips
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of str
</dd>
</dl>
<a NAME="CodeAssistServer.gotoDefinition" ID="CodeAssistServer.gotoDefinition"></a>
<h4>CodeAssistServer.gotoDefinition</h4>
<b>gotoDefinition</b>(<i>editor</i>)
<p>
        Public slot to find the definition for the word at the cursor position
        and go to it.
</p>
<p>
        Note: This is executed upon a mouse click sequence.
</p>

<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the calling editor
</dd>
</dl>
<a NAME="CodeAssistServer.handleCall" ID="CodeAssistServer.handleCall"></a>
<h4>CodeAssistServer.handleCall</h4>
<b>handleCall</b>(<i>method, params</i>)
<p>
        Public method to handle a method call from the client.
</p>

<dl>

<dt><i>method</i> (str)</dt>
<dd>
requested method name
</dd>
<dt><i>params</i> (dict)</dt>
<dd>
dictionary with method specific parameters
</dd>
</dl>
<a NAME="CodeAssistServer.handleNewConnection" ID="CodeAssistServer.handleNewConnection"></a>
<h4>CodeAssistServer.handleNewConnection</h4>
<b>handleNewConnection</b>(<i></i>)
<p>
        Public slot for new incoming connections from a client.
</p>

<a NAME="CodeAssistServer.isSupportedLanguage" ID="CodeAssistServer.isSupportedLanguage"></a>
<h4>CodeAssistServer.isSupportedLanguage</h4>
<b>isSupportedLanguage</b>(<i>language</i>)
<p>
        Public method to check, if the given language is supported.
</p>

<dl>

<dt><i>language</i> (str)</dt>
<dd>
editor programming language to check
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating the support status
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="CodeAssistServer.reportChanged" ID="CodeAssistServer.reportChanged"></a>
<h4>CodeAssistServer.reportChanged</h4>
<b>reportChanged</b>(<i>filename, oldSource</i>)
<p>
        Public slot to report some changed sources.
</p>

<dl>

<dt><i>filename</i> (str)</dt>
<dd>
file name of the changed source
</dd>
<dt><i>oldSource</i> (str)</dt>
<dd>
source code before the change
</dd>
</dl>
<a NAME="CodeAssistServer.requestCodeDocumentation" ID="CodeAssistServer.requestCodeDocumentation"></a>
<h4>CodeAssistServer.requestCodeDocumentation</h4>
<b>requestCodeDocumentation</b>(<i>editor</i>)
<p>
        Public method to request source code documentation for the given
        editor.
</p>

<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor to get source code documentation
            for
</dd>
</dl>
<a NAME="CodeAssistServer.requestCompletions" ID="CodeAssistServer.requestCompletions"></a>
<h4>CodeAssistServer.requestCompletions</h4>
<b>requestCompletions</b>(<i>editor, context, acText</i>)
<p>
        Public method to request a list of possible completions.
</p>

<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor object, that called this method
</dd>
<dt><i>context</i> (bool)</dt>
<dd>
flag indicating to autocomplete a context
</dd>
<dt><i>acText</i> (str)</dt>
<dd>
text to be completed
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial