The swig-language-server
extension provides a language server for SWIG interface files, offering essential tools to enhance your development experience. It includes a linter, syntax highlighting, code completion, and other features for .i
or .swig
files.
This extension provides the following features for SWIG interface files:
- Code Completion: Provides autocompletion for SWIG directives like
%module
,%include
,%typemap
, and more. - Hover Information: Displays documentation for SWIG directives (e.g.,
%module
,%include
) when hovering over them. - Document Symbols: Displays an outline of the SWIG file, including modules, includes, and typedefs.
- Folding Ranges: Supports folding for
%{ ... %}
blocks and multi-line comments.
- Diagnostics: Highlights potential issues in your SWIG interface files, such as:
- Unmatched
%{
and%}
blocks. - Missing semicolons for non-block directives.
- Unsupported data types like
long double
. - Incorrect usage of SWIG directives like
%rename
or%apply
.
- Unmatched
- Real-Time Validation: Automatically validates SWIG files when they are opened or edited.
- SWIG-Specific Constructs: Highlights SWIG directives like
%module
,%include
,%typemap
, and more.
- Tokenization: Tokenizes SWIG files and provides semantic tokens for better syntax understanding.
- Custom Scopes: Highlights SWIG-specific constructs differently from standard C/C++ code.
- Indentation Rules: Automatically adjusts indentation for blocks and directives.
- Bracket Matching: Supports auto-closing and matching for
{}
,[]
,()
, and%{ %}
.
- Lint SWIG File: Manually run the linter on the current SWIG file using the
swig-language-server.swigValidate
command. - Tokenize SWIG File: Tokenize the current SWIG file and display the tokens in an output channel using the
swig-language-server.tokenize
command.
- Hover Documentation: Provides detailed descriptions for SWIG directives.
- Output Channel: Displays tokenized output for debugging purposes.
This extension requires the following:
- A working knowledge of SWIG interface files.
- Works without any configured swig executable.
This extension contributes the following settings:
swigLanguageServer.enable
: Enable/disable the SWIG Language Server.swigLanguageServer.lintOnSave
: Enable/disable linting on file save.
- Some advanced SWIG features may not be fully supported.
- The linter might produce false positives in complex scenarios.
- Syntax highlighting for inline C/C++/Perl/Python code may not be fully accurate.
- Initial release of
swig-language-server
. - Added basic linter, syntax highlighting, and code completion for SWIG interface files.
- Added hover documentation for SWIG constructs like
%apply
,%rename
, etc. - Added auto-closing of brackets and
%{ %}
blocks. - Added diagnostics for unsupported data types like
long double
.
Enjoy coding with SWIG!