Adjust Ada snippets to styleguide
Test Neovim config on push / build (ubuntu-20.04) (push) Failing after 27s Details

This commit is contained in:
Yannick Reiß 2025-02-24 07:37:01 +01:00
parent cca29ca695
commit 886d434849
1 changed files with 19 additions and 19 deletions

View File

@ -36,15 +36,15 @@ def find_candidate(tabstop, search_type):
endglobal endglobal
snippet helloworld "Hello world example to test features" b snippet helloworld "Hello world example to test features" b
-- `!p snip.rv = fn` -- `!p snip.rv = fn`
-- Created on: `date` -- Created on: `date`
-- Author(s): Yannick Reiss <yannick.reiss@nickr.eu> -- Author(s): Yannick Reiss <yannick.reiss@nickr.eu>
-- Content: Hello world example -- Content: Hello world example
with Ada.Text_IO; use Ada.Text_IO; with Ada.Text_IO; use Ada.Text_IO;
-- @name ${1:`!p snip.rv = fn[0].upper() + fn[1:].split('.')[0]`} -- @name ${1:`!p snip.rv = fn[0].upper() + fn[1:].split('.')[0]`}
-- @return -- @return
-- @description Function printing hello world. -- @description Function printing hello world.
procedure $1 is procedure $1 is
begin begin
@ -53,16 +53,16 @@ end $1;$0
endsnippet endsnippet
snippet docstring "Document String with most important information" b snippet docstring "Document String with most important information" b
-- `!p snip.rv = fn` -- `!p snip.rv = fn`
-- Created on: `date` -- Created on: `date`
-- Author(s): ${1:Yannick Reiß} -- Author(s): ${1:Yannick Reiß}
-- Description: ${2:`!p snip.rv = fn.split('.')[0]`} -- Description: ${2:`!p snip.rv = fn.split('.')[0]`}
$0 $0
endsnippet endsnippet
snippet procedure "insert procedure" b snippet procedure "insert procedure" b
-- @name $1 -- @name $1
-- @return -- @return
`!p `!p
snip.rv = "" snip.rv = ""
if t[2].startswith("l"): if t[2].startswith("l"):
@ -96,7 +96,7 @@ for variable in variables:
if not variable == "" and not variable.startswith("typ"): if not variable == "" and not variable.startswith("typ"):
variableless = variable.replace("\t", "").replace (" ", "") variableless = variable.replace("\t", "").replace (" ", "")
snip.rv += f"-- @variable {variableless}\n" snip.rv += f"-- @variable {variableless}\n"
`-- @description $4 `-- @description $4
procedure ${1:`!p snip.rv = fn.split('.')[0].capitalize()`} `!p snip.rv = "" if t[2] == "" else "("`${2:N : Natural}`!p snip.rv = "" if t[2] == "" else ")"` is procedure ${1:`!p snip.rv = fn.split('.')[0].capitalize()`} `!p snip.rv = "" if t[2] == "" else "("`${2:N : Natural}`!p snip.rv = "" if t[2] == "" else ")"` is
$3 $3
begin begin
@ -105,8 +105,8 @@ end $1;$0
endsnippet endsnippet
snippet function "insert function" b snippet function "insert function" b
-- @name $1 -- @name $1
-- @return $3 -- @return $3
`!p `!p
snip.rv = "" snip.rv = ""
if t[2].startswith("l"): if t[2].startswith("l"):
@ -129,7 +129,7 @@ for parameter in parameters:
for parameter in parameter_list: for parameter in parameter_list:
if not parameter == "" and not parameter.startswith("typ"): if not parameter == "" and not parameter.startswith("typ"):
parameterless = parameter.replace("\t", "") parameterless = parameter.replace("\t", "")
snip.rv += f"-- @parameter {parameterless}\n" snip.rv += f"-- @parameter {parameterless}\n"
``!p ``!p
snip.rv = "" snip.rv = ""
if t[4].startswith("l"): if t[4].startswith("l"):
@ -139,7 +139,7 @@ else:
for variable in variables: for variable in variables:
if not variable == "" and not variable.startswith("typ") and not variable.startswith("--"): if not variable == "" and not variable.startswith("typ") and not variable.startswith("--"):
variableless = variable.replace("\t", "").replace (" ", "") variableless = variable.replace("\t", "").replace (" ", "")
snip.rv += f"-- @variable {variableless}\n" snip.rv += f"-- @variable {variableless}\n"
` -- @description $5 ` -- @description $5
function ${1:`!p snip.rv = fn.split('.')[0].capitalize()`} `!p snip.rv = "" if t[2] == "" else "("`${2:N : Natural}`!p snip.rv = "" if t[2] == "" else ")"` return ${3:Natural} is function ${1:`!p snip.rv = fn.split('.')[0].capitalize()`} `!p snip.rv = "" if t[2] == "" else "("`${2:N : Natural}`!p snip.rv = "" if t[2] == "" else ")"` return ${3:Natural} is
$4 $4
@ -178,7 +178,7 @@ project ${1:Default} is
for Main use ("${5:main.adb}"); for Main use ("${5:main.adb}");
for Languages use ("Ada"); for Languages use ("Ada");
end $1; end $1;
-- Create dir? (y/): ${6:no}`!p -- Create dir? (y/): ${6:no}`!p
from os import system from os import system
if t[6] == "y": if t[6] == "y":
system(f"mkdir -p {t[2]}") system(f"mkdir -p {t[2]}")