# eric7.JediInterface.JediServer

Module implementing the autocompletion interface to jedi.

### Global Attributes

None

### Classes

JediServer | Class implementing the interface to the jedi library.

### Functions

None

## JediServer

Class implementing the interface to the jedi library.

### Derived from

EricJsonServer

### Class Attributes

IdProject
PictureIDs

### Class Methods

None

### Methods

JediServer | Constructor
__applyRefactoring | Private method to apply a given refactoring.
__cancelRefactoring | Private method to cancel a given refactoring.
__checkRefactoringResult | Private method to check the refactoring result for errors.
__ensureActive | Private method to ensure, that the requested client is active.
__idString | Private method to determine the ID string for the back-end.
__interpreterForProject | Private method to determine the interpreter for the current project and the environment to run it.
__prepareData | Private method to gather data about current cursor position.
__processCallTipsResult | Private method to process the calltips sent by the client.
__processClientException | Private method to handle exceptions of the refactoring client.
__processCompletionsResult | Private method to process the completions sent by the client.
__processDocumentationResult | Private method to process the documentation sent by the client.
__processGotoDefinitionResult | Private method callback for the goto definition result.
__processGotoReferencesResult | Private method callback for the goto references result.
__processHoverHelpResult | Private method callback for the goto definition result.
__projectClosed | Private slot to handle the projectClosed signal.
__projectOpened | Private slot to handle the projectOpened signal.
__showRefactoringDiff | Private method to show the diff of a refactoring.
__startJediClient | Private method to start the Jedi client with the given interpreter.
__updateEditorLanguageMapping | Private method to update the editor language to connection mapping.
activate | Public method to activate the Jedi server.
deactivate | Public method to deactivate the code assist server.
forgetEditor | Public method to forget about the given editor.
getCallTips | Public method to calculate calltips.
gotoDefinition | Public slot to find the definition for the word at the cursor position and go to it.
handleCall | Public method to handle a method call from the client.
handleNewConnection | Public slot for new incoming connections from a client.
hoverHelp | Public method to initiate the display of mouse hover help.
isSupportedLanguage | Public method to check, if the given language is supported.
refactoringExtractFunction | Public slot to extract an expression to a function.
refactoringExtractNewVariable | Public slot to extract a statement to a new variable.
refactoringInlineVariable | Public slot to inline the selected variable.
refactoringRenameVariable | Public slot to rename the selected variable.
requestCodeDocumentation | Public method to request source code documentation for the given editor.
requestCompletions | Public method to request a list of possible completions.

### Static Methods

None

#### JediServer (Constructor)

JediServer(viewManager, project, ui)

Constructor

viewManager (ViewManager)
  reference to the viewmanager object
project (Project)
  reference to the project object
ui (UserInterface)
  reference to the user interface

#### JediServer.__applyRefactoring

__applyRefactoring(uid)

Private method to apply a given refactoring.

uid (str)
  UID of the calculated refactoring

#### JediServer.__cancelRefactoring

__cancelRefactoring(uid)

Private method to cancel a given refactoring.

uid (str)
  UID of the calculated refactoring

#### JediServer.__checkRefactoringResult

__checkRefactoringResult(result)

Private method to check the refactoring result for errors.

result (dict)
  dictionary containing the result data

#### JediServer.__ensureActive

__ensureActive(idString)

Private method to ensure, that the requested client is active.

A non-active client will be started.

idString (str)
  id of the client to be checked

Return:
  flag indicating an active client

Return Type:
  bool

#### JediServer.__idString

__idString(editor)

Private method to determine the ID string for the back-end.

editor (Editor)
  reference to the editor to determine the ID string for

Return:
  ID string

Return Type:
  str

#### JediServer.__interpreterForProject

__interpreterForProject()

Private method to determine the interpreter for the current project and the environment to run it.

Return:
  tuple containing the interpreter of the current project and the environment variables

Return Type:
  tuple of (str, dict)

#### JediServer.__prepareData

__prepareData(editor)

Private method to gather data about current cursor position.

editor (Editor)
  reference to the editor object, that called this method

Return:
  tuple of filename, line, index, source

Return Type:
  tuple (str, int, int, str)

#### JediServer.__processCallTipsResult

__processCallTipsResult(result)

Private method to process the calltips sent by the client.

result (dict)
  dictionary containing the result sent by the client

#### JediServer.__processClientException

__processClientException(params)

Private method to handle exceptions of the refactoring client.

params (dict)
  dictionary containing the exception data

#### JediServer.__processCompletionsResult

__processCompletionsResult(result)

Private method to process the completions sent by the client.

result (dict)
  dictionary containing the result sent by the client

#### JediServer.__processDocumentationResult

__processDocumentationResult(result)

Private method to process the documentation sent by the client.

result (dict with keys 'name', 'module', 'argspec', 'docstring')
  dictionary containing the result sent by the client

#### JediServer.__processGotoDefinitionResult

__processGotoDefinitionResult(result)

Private method callback for the goto definition result.

result (dict)
  dictionary containing the result data

#### JediServer.__processGotoReferencesResult

__processGotoReferencesResult(result)

Private method callback for the goto references result.

result (dict)
  dictionary containing the result data

#### JediServer.__processHoverHelpResult

__processHoverHelpResult(result)

Private method callback for the goto definition result.

result (dict)
  dictionary containing the result data

#### JediServer.__projectClosed

__projectClosed()

Private slot to handle the projectClosed signal.

#### JediServer.__projectOpened

__projectOpened()

Private slot to handle the projectOpened signal.

#### JediServer.__showRefactoringDiff

__showRefactoringDiff(result)

Private method to show the diff of a refactoring.

result (dict)
  dictionary containing the result data

#### JediServer.__startJediClient

__startJediClient(interpreter, idString, clientEnv)

Private method to start the Jedi client with the given interpreter.

interpreter (str)
  interpreter to be used for the Jedi client
idString (str)
  id of the client to be started
clientEnv (dict)
  dictionary with environment variables to run the interpreter with

Return:
  flag indicating a successful start of the client

Return Type:
  bool

#### JediServer.__updateEditorLanguageMapping

__updateEditorLanguageMapping()

Private method to update the editor language to connection mapping.

#### JediServer.activate

activate()

Public method to activate the Jedi server.

#### JediServer.deactivate

deactivate()

Public method to deactivate the code assist server.

#### JediServer.forgetEditor

forgetEditor(editor)

Public method to forget about the given editor.

editor (Editor)
  reference to the editor to forget about

#### JediServer.getCallTips

getCallTips(editor, pos, commas)

Public method to calculate calltips.

editor (Editor)
  reference to the editor object, that called this method
pos (int)
  position in the text for the calltip
commas (int)
  minimum number of commas contained in the calltip

Return:
  list of possible calltips

Return Type:
  list of str

#### JediServer.gotoDefinition

gotoDefinition(editor)

Public slot to find the definition for the word at the cursor position and go to it.

Note: This is executed upon a mouse click sequence.

editor (Editor)
  reference to the calling editor

#### JediServer.handleCall

handleCall(method, params)

Public method to handle a method call from the client.

method (str)
  requested method name
params (dict)
  dictionary with method specific parameters

#### JediServer.handleNewConnection

handleNewConnection()

Public slot for new incoming connections from a client.

#### JediServer.hoverHelp

hoverHelp(editor, line, index)

Public method to initiate the display of mouse hover help.

editor (Editor)
  reference to the calling editor
line (int)
  line number (zero based)
index (int)
  index within the line (zero based)

#### JediServer.isSupportedLanguage

isSupportedLanguage(language)

Public method to check, if the given language is supported.

language (str)
  editor programming language to check

Return:
  flag indicating the support status

Return Type:
  bool

#### JediServer.refactoringExtractFunction

refactoringExtractFunction()

Public slot to extract an expression to a function.

#### JediServer.refactoringExtractNewVariable

refactoringExtractNewVariable()

Public slot to extract a statement to a new variable.

#### JediServer.refactoringInlineVariable

refactoringInlineVariable()

Public slot to inline the selected variable.

Note: This is the opposite to Extract New Variable.

#### JediServer.refactoringRenameVariable

refactoringRenameVariable()

Public slot to rename the selected variable.

#### JediServer.requestCodeDocumentation

requestCodeDocumentation(editor)

Public method to request source code documentation for the given editor.

editor (Editor)
  reference to the editor to get source code documentation for

#### JediServer.requestCompletions

requestCompletions(editor, context, acText)

Public method to request a list of possible completions.

editor (Editor)
  reference to the editor object, that called this method
context (bool)
  flag indicating to autocomplete a context
acText (str)
  text to be completed

Up