So say I have C++ Intellisense and I also want to deploy my own autocomplete extension, that would provide a small autocomplete functionality based on different conditions.
My question is would my autocomplete extension work by extending the C++ Intellisense or by replacing it and becoming the only autocomplete extension? If the answer is latter then what are my Options?
C++ Intellisense is just an example that I would have to deal in my project, it can be any other small autocomplete extension that works on the same .cpp file.
I have tried to perform a similar experiment using the vscode-extension-sample of autocomplete on PlainText file. Where just writing a Lorem Ipsum before trying the Extension Sample and then just writing any single word from Lorem Ipsum does not autocomplete. It is possible that this is not a good example, because as much I am aware there are no Intellisense for plaintext and VSCode may be using it's own built in auto-complete features that are overridden in case of plaintext.
Also the Activation Event was onStartup * because of other features in my trial extension.
So inorder to make sure that both intellisense and autocomplete work together in your extension, you have to use registerCompletionItemProvider, but where you will put DocumentSelector as *.
This is because if you put a specific stuff like {language: "cpp"}, the match score is of 10, higher than intellisense and if you are always returning some result, then no way Intellisense will work in parallel, so it also opens possibility of providing specific result.
Source:
add completionitemprovider and keep suggestions Look at comments.
https://github.com/microsoft/vscode/issues/24464
Related
Is there any way to get another editor, like VSCode, to format code ( JavaScript in my case, if it matters ) like the WebStorm IDE formats code by default? I'm not familiar with that IDE, but I'm hoping that it uses a config of some sort that can maybe be exported and imported in another editor. I tried looking for one, but couldn't find anything.
The core problem, if it matters, is that all of our team members use WS to write code and they use the built in formatter, so if I use another one it creates inconsistencies and long commits when editing already written files. As you are probably guessing by now, I would like to use another editor, because I find IDE's bloated and slow.
I don't know if there is a way to import Webstorm formatting rules into VS Code, but I think there is another solution:
I remember in one of the projects i worked on, we used a linter which also auto-formatted code. The advantage is that Webstorm and VSCode can pick pick the linter rules automatically, and then you have same formatting on both.
The downside is that you would need to agree with the team on what does rule will be and then configure them on the linter.
I'm building an extension providing a syntax highlighting for the 'Jack' language used in an online course I am taking (Nand2Tetris at Coursera - it is not a part of the course assignment). I have the syntax highlighting rules ready, but I would like to add custom formatting for some language elements. In particular, I would like type definitions to appear in italic.
I know how to change the user settings to get the desired result on my VS Code installation, but I would like that formatting to be the default behavior for anyone using the extension.
I've tried to create a new theme extension and then copy paste the 'themes' folder from it to the 'syntax' extension and reference the file from that folder in package.json, but it didn't work. I also tried adding the 'configuration' setting in the 'contributes' section of package.json, without success. I browsed numerous VC Code extensions on GitHub and couldn't find one providing similar functionality.
Is it even possible to provide syntax definition and 'theming' in one extension? If so how?
Based on VS Code Semantic Highlight Guide, besides syntax highlighting rules, you'll also need
Implement and register a Semantic token provider in your extension.
Declare Enablement of semantic highlighting in settings.json.
Customize tokens in Theming.
VS Code team kindly provides a Semantic tokens sample. Note that this example skips step 3 and customizes tokens directly in settings.json.
Qt Creator, Eclipse, and almost IDE's have an auto-complete for the functions that I had created in the headers files and I can navigate through the definitions of the functions.
First I want to know how that feature is called so I can search if it is possible to do the same with sublime text.
Thanks
It is called code completion. Keep in mind that to show up functions defined in other than the current file, you need to create a project (or whatever sublime calls this) so it can scan further files.
You might find this question usefull:
Sublime Text 2 and ZF2 ... auto complete not works
I'm trying to develop a small plugin that will do a sort-of auto-completion along with some other advanced features in order to create a primitive IDE to use with a custom scripting language we've developed.
So I want to know, how do the auto-complete plugins usually work? I have a basic plugin template that I'm playing around with (the C# one) and I see how the commands work, from a high level anyway, but I'm trying to figure out how I would create my auto-complete feature.
My first guess would be to make a command that spawned a new thread that retrieved the entire contents of the notepad++ text every 100 mills or so and then popped-up a little selector box or directly wrote the auto-complete possibilities when the correct pattern was matched on the newly typed text.
Any wisdom from those who have gone before me on this?
Thanks alot.
Well I figured it out. Apparently there is a "beNotified" method in my project template that I downloaded and it handles all events/notifications from the Scintilla/Notepad++ environment. I will probably be using the SCN_CHARADDED event to check the current line of text each time a character is added to the GUI.
I have a file with extension .xml.
But it doesn't necessarily contain XML. It may also contain HTML and JavaScript. Now I would like to either have Eclipse decide inteligently/heuristically which syntax highlighting would be appropriate or to switch it myself.
Any ideas?
Eclipse associates files with an editor. You can let eclipse decide which editor to use (e.g. defaults per file extension) or select the editor by yourself. I guess you might already know that or have at least experienced it.
Syntax highlighting isn't always set seperately but instead part of some editor (together with stuff like keyboard shortcuts). So what you are going to need is an editor that behaves the way you want it to. I do not know if there is an editor like this available but one options is writing an eclipse plug-in and implementing such an editor.
Fortunately there are great editors for each of XML, javascript, HTML, etc that are all open source. I guess you might be able to use some of their code. Ideally as a client of their API / Objects or if it won't work out just by reusing code.
short answer: not possible. use PHPStorm instead :)