Does syntax highlighting of modules work?

SyntaxEditor Python Language Add-on for WPF Forum

Posted 4 years ago by Bob Puckett
Version: 15.1.0622
Avatar

Syntax highlighting in my application works fine if the module I try to use is a standard module or I don't use any modules.

However, trying to use my own modules does not provide highlighting.

My module called TestModule.py

# Automation Script 'new script 1'

def hello():
    print 'Hello World.'

here is my main script:

# Automation Script 'new script 1'
import TestModule
from TestModule import *

hello()

Here is my initialization code wheer I set search paths:


// Configure the Python Language Project and set the search paths
myPythonProject = myPythonSyntaxLanguage.GetService<IProject>();
myPythonProject.SearchPaths.Add(ironPythonLibrariesPath);
myPythonProject.SearchPaths.Add(@"C:\PythonTestLibs");

Shouldn't hello() show up as highlighted?  Shouldn't typing 'he' and then ctrl-space bring up a list of functions including 'hello'?

If I place the def in the same file as:

# Automation Script 'new script 1'
def hello():
print 'Hello World.'

he

when I hit ctrl-space, hello is in he list.  But not from a module.

Comments (4)

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Bob,

The text "hello" won't show up as highlighted since it's an identifier, but it should show up in the completion list.  I just did a simple test of what you showed above with TestModule.py in a folder that was added to SearchPaths and when I did Ctrl+Space in the main document script, I saw "hello" listed in the completion list.


Actipro Software Support

Posted 4 years ago by Bob Puckett
Avatar

Great.  I must have a problem in my code to add search paths.

Posted 4 years ago by Bob Puckett
Avatar

Maybe my problem was that my document may not have had a file anme set - so maybe relative paths didn't work.

Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Bob,

Yes, make sure you follow all the steps (such as setting the document's filename)  in the Getting Started topic in the documentation.  If you miss any of those items, things might not work properly.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.