[QScintilla] How to do AutoCompletion? Is there an example?

Phil Thompson phil at riverbankcomputing.com
Thu Mar 15 22:03:41 GMT 2007


On Thursday 15 March 2007 6:57 pm, Timo Rothenpieler wrote:
> Ok, i get it working with the Python Lexer, but not with my BMax Lexer.
> What do i have to do for getting my Lexer work with Auto-Completion?
>
> Here is the Lexer-Class:
> ------------
> class QSCINTILLA_EXPORT QsciLexerBMax : public QsciLexer
> {
> 	Q_OBJECT
>
> 	public:
>
> 	enum {
> 		Default = 0,
> 		Comment = 1,
> 		Number = 2,
> 		Keyword = 3,
> 		String = 4,
> 		MLComment = 5,
> 		Identifier = 6,
> 		HexNumber = 7,
> 		Operator = 8,
> 		BinNumber = 9,
> 		StringLiteral = 10,
> 		Extern = 11
> 	};
>
> 	QsciLexerBMax(QObject* parent=0);
> 	virtual ~QsciLexerBMax();
>
> 	const char* language() const;
> 	const char* lexer() const;
> 	const char* blockEnd(int *style = 0) const;
> 	const char* blockStart(int *style = 0) const;
> 	QString description(int style) const;
> 	const char* wordCharacters() const;
> 	const char* keywords(int set) const;
> 	int autoIndentStyle();
> 	QColor color(int style) const;
> 	QFont font(int style) const;
> 	QColor paper(int style) const;
>
> 	public slots:
> 	void setFont(const QFont &f,int style=-1);
> 	void setColor(const QColor &c,int style=-1);
> 	void setPaper(const QColor &c,int style=-1);
> 	void setKeywords(QString s);
>
> 	private:
> 	QColor frontColors[12];
> 	QColor paperColors[12];
> 	QFont  fonts[12];
> 	QString keywordList;
> };
> ------------

You would need to reimplement autoCompletionWordSeparators() as well. I guess 
the current code is wrongly assuming that a language that could usefully use 
auto-completion would have some concept of a scope. Does BMax?

I need to fix QsciAPIs to work when no word separators are defined.

Phil


More information about the QScintilla mailing list