I'm trying to develop an vs code extension by using its javascript apis.
i have a .hocon file (https://github.com/lightbend/config/blob/master/HOCON.md) the file is fairly complex and i would like to create an autocomplete feature.
My problem:
1] I have a dictionary file, its a simple text file for sake of example lets assume its toml/csv something easy to parse
[ips]
x.x.x.x
y.y.y.y
some.ipv6
[actions]
someString1
someString2
2] the hocon file contains two arrays
Ips: [
]
Actions: [
]
When a user places a cursor inside the Ips array, i want to show standard code-completion pop up window which will contain list of ips from the dictionary file, but won't contain a single record from the actions block.
My question is: I looked at the vs code documentation and I feel like this cannot be solved by a simple vscode extension, but I should use some language server? Am I correct?
Related
I use VS code for lots of things, from actual programming to just taking notes or conspecting. A few features I would really love would be
ability to insert images in between the text
live, cell based auto formatting for text that forms a small table
Both of these can be done in rich text editors like ms word by inserting just images or an excel table.
Now I realize that VS code is rather file format agnostic and it wouldn't make a whole lot of sense to somehow have an excel table in the middle of a .js file but I think there is a way.
For example, JSDoc is a kind of add-on format that lives entirely within js comments. Same could be done with tables and/or images. Of course there wouldn't be a universal way to encode this but just like JSDoc it could be adapted to different language environments, be it a php file or c file or plain text.
For example, in raw text format, an auto formatted table of data could look something like this within a javascript file:
const my_data = [
/*!!! auto_format_csv(Title, Description, Weight) !!!*/
"Apple", "A nice fruit", 1,
"Car", "A motorized vehicle", 2000
/*!!! auto_format_end !!!*/
];
and while editing the file in vs code, it could look something like this:
So to the question part: are there perhaps any extensions that already do this sort of thing? If not, is it possible to create such an extension with the liberties given to extensions as of right now?
I know that vs code is based on electron and open source so in theory, everything is possible but I want to have these features as easily as possible so having framework support for this would likely help a lot.
I used vscode API createFileSystemWatcher global pattern to watch for changes in my workspace
vscode.workspace.createFileSystemWatcher("**/*.{*}");
It works, but I want to ignore watching a specific file extension.
I don't want to watch a ".txt" file extension, so I have tried something like this
vscode.workspace.createFileSystemWatcher("**/*.{*, !txt}");
it doesn't work. I'm trying not to list out all file extensions in the global pattern, as it may be endless.
I'm trying to update a README.md file on Github with an entry about C#. I've read numerous posts on how to make in text anchors using markdown. To be clear I have managed to make a link that works just writing Csharp, but I'd very much like to make it work with the hash symbol as well.
So basically I have a table of contents where I want to add C# and link to a point in the text further down with the same name:
## Table of Contents
- [C#](#c#)
(This does not make C# clickable)
And then further down:
## C#
- [Channel9](https://channel9.msdn.com/Series/CSharp-Fundamentals-for-Absolute-Beginners)
I've tried adding forward slash before the hash in both the table of contents and in the main text (i.e. #c/#). Doesn't work. The only way I seem to get the table of contents to make a link out of c# is by doing this (but then it doesn't link to anywhere)
- [C#](c/#)
Sorry this must be a really basic issue but I can't seem to find the solution.
It seems to work if you just remove the trailing # on the link. It probably can't use the # and just stops at the c.
## Table of Contents
- [C#](#c)
# C#
- [Channel9](https://channel9.msdn.com/Series/CSharp-Fundamentals-for-Absolute-Beginners)
I am importing a dataset from Google Cloud Storage (parameterized) into Dataprep. So far, this worked perfectly fine and one of the feature that I liked is that it auto detects that the first row in my (application/octet-stream) .csv file are my headers.
However, today I tried to import a new dataset and it did not detect the headers, but it auto assigned column1, column2...
What has changed and or why is this the case. I have checked the box auto-detect and use UTF-8:
While the auto-detect option is usually pretty good, there are times that it fails for numerous reasons. I've specifically noticed this when the field names contain certain characters (e.g. comma, invisible characters like zero-width-non-joiners, null bytes), or when multiple different styles of newline delimiters are used within the same file.
Another case I saw this is when there were more columns of data than there were headers.
As you already hit on, you can use the following snippet to do mostly the same thing:
rename type: header method: filter sanitize: true
. . . or make separate recipe steps to convert the first row to header and then bulk-rename to your own liking.
More often than not, however, I've found that when auto-detect fails on a previously working file, it tends to be a sign of some sort of issue with the source file. I would look for mismatched data, as well as misplaced commas within the output, as well as comparing the header and some data rows to the original source using a plaintext editor.
When all else fails, you can try a CSV validator . . . but in my experience they tend to be incredibly opinionated when it comes to the formatting options of the fileāso depending on the system generating the CSV, it could either miss any errors or give false-positives. I have had two experiences where auto-detect fails for no apparent reason on perfectly clean files, so it is possible that process was just skipped for some reason.
It should also be noted that if you have a structured file that was correctly detected but want to revert it, you can go to the dataset details, select the "..." (More) button, and choose "Remove structure..." (I'm hoping that one day they'll let you do the opposite when you want to add structure to a raw dataset or work around bugs like this!)
Best of luck!
Can be resolved as a transformation within a Flow:
rename type: header method: filter sanitize: true
I've been doing a lot of MaxScript lately and have mashed together (from an attempt here) a ST2 plugin for evaluating scripts from ST.
I've got the syntax highlighting working as well as evaluating the whole file and the current selection, but what I need (due partly to my bad memory and also the gigantic number of MaxScript built-in functions, not to mention those exposed by other plugins I'm using) is for the autocomplete list to be populated initially by a separate text file containing the built-in function names (generated by these instructions) and then the file's own names.
The text file is of the following format:
...
<function name>
polyOps.createShapeFromEdges
polyOps.startCutEdge
polyOps.selectByID
polyOps.attachList
polyOps.startExtrudeEdge
...
Can anyone give me any pointers?
The completions docs have all the information you'll need. Briefly, .sublime-completions files are JSON-formatted resources that can contain either simple completions or snippets. For example, a simple completions list using your given terms would look like this:
{
"scope": "source.maxscript",
"completions": [
"polyOps.createShapeFromEdges",
"polyOps.startCutEdge",
"polyOps.selectByID",
"polyOps.attachList",
"polyOps.startExtrudeEdge"
]
}
If you would like to use snippet syntax for more complex auto-completion (for example, to fill in default values for a function), it would look something like this:
{
"scope": "source.maxscript",
"completions": [
{ "trigger": "myfunc", "contents": "my_function(${1:param}=${2:value})$0" },
"polyOps.createShapeFromEdges",
"polyOps.startCutEdge",
"polyOps.selectByID",
"polyOps.attachList",
"polyOps.startExtrudeEdge"
]
}
Once you have your completions set up, save the file as Packages/User/LanguageName.sublime-completions where LanguageName is the name of your .tmLanguage file, and you should be all set. Good luck!