Totally new to atom: autocomplete help


#1

Hi all,

as I have to write tons of XPATH expressions I am looking for a tool, that supports me.
So I am looking for a feature where I can customize the autocompletion. Does ATOM provide such a plugIn? I saw some plugins but I am sure if they are customizable.

As I am totally new to ATOM I would appreciate any help. The internet and this forum is full of information and I cannot find what I am looking for.

Regards
Mario


#2

You could put them in your snippets.cson file. These will be picked up by the autocomplete-snippets package, and will appear in the popup menu as you type. More on writing snippets can be found in the link, but I can give you some assistance if you provide some prefix & body pairs you want (where the prefix is what you type, and the body is what it gets replaced with)

https://flight-manual.atom.io/using-atom/sections/snippets/

If you know some JS, you could write an autocomplete provider directly for autocomplete-plus. This is not necessary though, unless you want highly customised behaviour.


#3

Hi Aerijo,

may thanks for your quick reply and your offer to give some assistance. Is autocomplete-snippets preinstalled?
As I am german the english instuctions are sometimes hard to understand. And as I am totally new to ATOM it is more difficult :slight_smile:

Lets assume the following easy example.
When I type in a M I would like to show second names like

  • Miller
  • Manson or
  • Mansfield
    If I choose e.g. Miller I want to display the firstnames of the family Miller, e.g.
  • Peter
  • Paul
  • Mary

Is this possible? What do I have to do?
Many, many thanks for your help as I have to write approximatly 1500 XPATH statements :slight_smile:
Regards Mario


#4

I found a good intrdoduction on youtube:


#5

Could anybody please explain what is the meaning of ‘.source.js’?
Whe I open I new file, do I have to state what kind of file I am editing? (e.g. js, txt, xml)?
If yes , how do I achieve this? Just by saving the file with the fileextension (e.g. js, txt, xml)?

'.source.js':
  'Console log':
    'prefix': 'log'
    'body': 'Sampletext $1'

Thanks
Regards
Mario


#6

Yes

If the names are dependent on the names that came before them, you will probably need to write an autocomplete provider from scratch. From here, your knowledge of JavaScript is important. I can get you started, but you will need a working level of JS to finish it off.

Snippets are useful when the context is less important.

In Atom, every character in the file is assigned a “scope”. To see the scope of a particular character, place the cursor to the left of it and run in the command palette Editor: Log Cursor Scope. The scope source.js is applied to all characters in a JavaScript file. In the snippet definition, it tells Atom “only show this snippet when editing a JS file”.

The scopes themselves are applied automatically based on the file extension. If your document is being syntax-highlighted, then scopes are being applied.