NVim Omnisharp-Vim autocomplete on tab not working - autocomplete

Using NeoVim and autocomplete is not completing the suggestion.
For example:
I get the popup when start typing a word such as public.
I just start typing pu and then the dialogue pops up to suggest the full word, but when I hit tab is just adds a tab after the word with out completing.
Here is by init.vim if it helps
"set this to 1 to use ultisnips for snippet handling
let s:using_snippets = 0
" vim-plug: {{{
call plug#begin('~/.vim/plugged')
Plug 'omnisharp/omnisharp-vim'
" Mappings, code-actions available flag and statusline integration
Plug 'nickspoons/vim-sharpenup'
" Linting/error highlighting
Plug 'dense-analysis/ale'
" Vim FZF integration, used as OmniSharp selector
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
" Code Snippets
Plug 'SirVer/ultisnips'
" Autocompletion
Plug 'prabirshrestha/asyncomplete.vim'
" Colorscheme
Plug 'gruvbox-community/gruvbox'
" Statusline
Plug 'itchyny/lightline.vim'
Plug 'shinchu/lightline-gruvbox.vim'
Plug 'maximbaz/lightline-ale'
" File Navigation
Plug 'preservim/nerdtree'
" Snippet support
if s:using_snippets
Plug 'sirver/ultisnips'
endif
call plug#end()
" }}}
"
" Line Numbers
:set number relativenumber
:augroup numbertoggle
: autocmd!
: autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
: autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
:augroup END
" fuzzy file search
set runtimepath^=~/.vim/bundle/ctrlp.vim
" Settings: {{{
filetype indent plugin on
if !exists('g:syntax_on') | syntax enable | endif
set encoding=utf-8
scriptencoding utf-8
set completeopt=menuone,noinsert,noselect,preview
set backspace=indent,eol,start
set expandtab
set shiftround
set shiftwidth=4
set softtabstop=-1
set tabstop=8
set textwidth=80
set title
set hidden
set nofixendofline
set nostartofline
set splitbelow
set splitright
set hlsearch
set incsearch
set laststatus=2
set noruler
set noshowmode
set signcolumn=yes
set mouse=a
set updatetime=1000
" }}}
" Colors: {{{
augroup ColorschemePreferences
autocmd!
" These preferences clear some gruvbox background colours, allowing transparency
autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE
autocmd ColorScheme * highlight SignColumn ctermbg=NONE guibg=NONE
autocmd ColorScheme * highlight Todo ctermbg=NONE guibg=NONE
" Link ALE sign highlights to similar equivalents without background colours
autocmd ColorScheme * highlight link ALEErrorSign WarningMsg
autocmd ColorScheme * highlight link ALEWarningSign ModeMsg
autocmd ColorScheme * highlight link ALEInfoSign Identifier
augroup END
" Use truecolor in the terminal, when it is supported
if has('termguicolors')
set termguicolors
endif
set background=dark
colorscheme gruvbox
" }}}
" ALE: {{{
let g:ale_sign_error = '•'
let g:ale_sign_warning = '•'
let g:ale_sign_info = '·'
let g:ale_sign_style_error = '·'
let g:ale_sign_style_warning = '·'
let g:ale_linters = { 'cs': ['OmniSharp'] }
" }}}
" Asyncomplete: {{{
let g:asyncomplete_auto_popup = 1
let g:asyncomplete_auto_completeopt = 1
" }}}
" Sharpenup: {{{
" All sharpenup mappings will begin with `<Space>os`, e.g. `<Space>osgd` for
" :OmniSharpGotoDefinition
" let g:sharpenup_map_prefix = '<Space>os'
let g:sharpenup_map_prefix = ',os'
let g:sharpenup_statusline_opts = { 'Text': '%s (%p/%P)' }
let g:sharpenup_statusline_opts.Highlight = 0
augroup OmniSharpIntegrations
autocmd!
autocmd User OmniSharpProjectUpdated,OmniSharpReady call lightline#update()
augroup END
" }}}
" Lightline: {{{
let g:lightline = {
\ 'colorscheme': 'gruvbox',
\ 'active': {
\ 'right': [
\ ['linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok'],
\ ['lineinfo'], ['percent'],
\ ['fileformat', 'fileencoding', 'filetype', 'sharpenup']
\ ]
\ },
\ 'inactive': {
\ 'right': [['lineinfo'], ['percent'], ['sharpenup']]
\ },
\ 'component': {
\ 'sharpenup': sharpenup#statusline#Build()
\ },
\ 'component_expand': {
\ 'linter_checking': 'lightline#ale#checking',
\ 'linter_infos': 'lightline#ale#infos',
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok'
\ },
\ 'component_type': {
\ 'linter_checking': 'right',
\ 'linter_infos': 'right',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'right'
\ }
\ }
" Use unicode chars for ale indicators in the statusline
let g:lightline#ale#indicator_checking = "\uf110 "
let g:lightline#ale#indicator_infos = "\uf129 "
let g:lightline#ale#indicator_warnings = "\uf071 "
let g:lightline#ale#indicator_errors = "\uf05e "
let g:lightline#ale#indicator_ok = "\uf00c "
" }}}
" OmniSharp: {{{
let g:OmniSharp_server_stdio = 1
let g:OmniSharp_translate_cygwin_wsl = 1
let g:OmniSharp_popup_position = 'peek'
if has('nvim')
let g:OmniSharp_popup_options = {
\ 'winhl': 'Normal:NormalFloat'
\}
else
let g:OmniSharp_popup_options = {
\ 'highlight': 'Normal',
\ 'padding': [0, 0, 0, 0],
\ 'border': [1]
\}
endif
let g:OmniSharp_popup_mappings = {
\ 'sigNext': '<C-n>',
\ 'sigPrev': '<C-p>',
\ 'pageDown': ['<C-f>', '<PageDown>'],
\ 'pageUp': ['<C-b>', '<PageUp>']
\}
if s:using_snippets
let g:OmniSharp_want_snippet = 1
endif
let g:OmniSharp_highlight_groups = {
\ 'ExcludedCode': 'NonText'
\}
" }}}
"
imap <c-space> <Plug>(asyncomplete_force_refresh)
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() : "\<cr>"

I was being foolish, I should have used Ctl+P or Ctl+N.
Noob.
Closing ticket

Related

neovim's lsp does not show error messages

i have a neovim config which contains lsp configuration
on my laptop i have neovim 0.7.2 which works perfectly
but on my desktop i have neovim 0.8.0 and lsp still works but does not show error massages.
this is my config
vim.opt.tabstop = 2
vim.cmd([[colorscheme dedsec]])
vim.cmd([[set number]])
vim.cmd([[set noswapfile]])
vim.cmd([[set mouse=a]])
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.expandtab = true
require("packer").startup(function(use)
-- use "wbthompson/packer.nvim"
use "vim-airline/vim-airline"
use 'vim-airline/vim-airline-themes'
use 'ryanoasis/vim-devicons'
use 'jpalardy/vim-slime'
use 'shime/vim-livedown'
use 'ap/vim-css-color'
use 'terryma/vim-multiple-cursors'
use 'mattn/emmet-vim'
use 'scrooloose/nerdtree'
use 'mxw/vim-jsx'
-- LSP
use {
'VonHeikemen/lsp-zero.nvim',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'},
{'williamboman/mason.nvim'},
{'williamboman/mason-lspconfig.nvim'},
-- Autocompletion
{'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-buffer'},
{'hrsh7th/cmp-path'},
{'saadparwaiz1/cmp_luasnip'},
{'hrsh7th/cmp-nvim-lsp'},
{'hrsh7th/cmp-nvim-lua'},
-- Snippets
{'L3MON4D3/LuaSnip'},
{'rafamadriz/friendly-snippets'},
}
}
end)
vim.cmd([[
let g:airline_powerline_fonts = 1 "Включить поддержку Powerline шрифтов
let g:airline#extensions#keymap#enabled = 0 "Не показывать текущий маппинг
let g:airline_section_z = "\ue0a1:%l/%L Col:%c" "Кастомная графа положения курсора
let g:Powerline_symbols='unicode' "Поддержка unicode
let g:airline#extensions#xkblayout#enabled = 0 "Про это позже расскажу
set guioptions= "Отключаем панели прокрутки в GUI
set showtabline=1 "Отключаем панель табов (окошки FTW)
let g:slime_target = "tmux"
let g:slime_target = "neovim"
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-b> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
let g:user_emmet_mode='a'
set colorcolumn=109
]])
local lsp = require('lsp-zero')
lsp.preset('recommended')
lsp.nvim_workspace()
lsp.setup()
local servers = { 'pyright', 'tsserver', 'jdtls', 'rust-analyzer', 'clangd', 'sumneko_lua'}
for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
}
}
end
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl= hl, numhl = hl })
end
this is how it works on laptop
this is how it works on my desktop
i have tried to install neovim 0.7.2 but it does not help me
i also have tired to update and reinstall plugins but it also does not help
https://github.com/VonHeikemen/lsp-zero.nvim/blob/v1.x/doc/md/lsp.md#diagnostics
simply follow this documentation.
change
virtual_text = false,
to
virtual_text = true,
if you have the same situation try to install williamboman/nvim-lsp-installer. it have halped in my situation

Error detected while processing function SwitchFlowOrTsLsps nvim windows 10

Hello I tried to enter a js file and upon entering I got this error:
Error detected while processing function SwitchFlowOrTsLsps:
line 4:
E121: Undefined variable: state
E15: Invalid expression: (tsserver.state == 'disabled')
Try to find the line that tells me in the different files such as maps, plugin or plugin config, the last one is the one I found it in, before I did not suffer from this error because I was only entering py, cpp and java extension files, I have the coc, but do not download anything for this, I also have the kite installed as a plugin for autocompletion
" HTML, JSX
let g:closetag_filenames = '*.html,*.js,*.jsx,*.ts,*.tsx'
" Lightlane
let g:lightline = {
\ 'active': {
\ 'left': [['mode', 'paste'], [], ['relativepath', 'modified']],
\ 'right': [['kitestatus'], ['filetype', 'percent', 'lineinfo'], ['gitbranch']]
\ },
\ 'inactive': {
\ 'left': [['inactive'], ['relativepath']],
\ 'right': [['bufnum']]
\ },
\ 'component': {
\ 'bufnum': '%n',
\ 'inactive': 'inactive'
\ },
\ 'component_function': {
\ 'gitbranch': 'fugitive#head',
\ 'cocstatus': 'coc#status'
\ },
\ 'colorscheme': 'gruvbox',
\ 'subseparator': {
\ 'left': '',
\ 'right': ''
\ }
\}
" nerdtree
let NERDTreeShowHidden=1
let NERDTreeQuitOnOpen=1
let NERDTreeAutoDeleteBuffer=1
let NERDTreeMinimalUI=1
let NERDTreeDirArrows=1
let NERDTreeShowLineNumbers=1
let NERDTreeMapOpenInTab='\t'
let g:javascript_plugin_flow = 1
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsSnippetDirectories=[$HOME.'/config/.vim/UltiSnips']
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<S-tab>"
" deoplete
let g:deoplete#enable_at_startup = 1
let g:neosnippet#enable_completed_snippet = 1
" kite
let g:kite_supported_lenguages = ['javascript', 'python']
" coc
autocmd FileType python let b:coc_suggest_disable = 1
autocmd FileType javascript let b:coc_suggest_disable = 1
autocmd FileType scss setl iskeyword+=#-#
command! -bang -nargs=? -complete=dir GFiles
\ call fzf#vim#gitfiles(<q-args>, fzf#vim#with_preview(), <bang>0)
command! -bang -nargs=* Ag
\ call fzf#vim#ag(<q-args>, fzf#vim#with_preview(), <bang>0)
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
" if hidden is not set, TextEdit might fail.
set hidden
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup
" Better display for messages
set cmdheight=2
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300
" don't give |ins-completion-menu| messages.
set shortmess+=c
" always show signcolumns
set signcolumn=yes
" fugitive always vertical diffing
set diffopt+=vertical
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
autocmd BufEnter *.js :silent let myIndex = SearchPatternInFile("#flow") | call SwitchFlowOrTsLsps(myIndex)
autocmd BufEnter *.jsx :silent let myIndex = SearchPatternInFile("#flow") | call SwitchFlowOrTsLsps(myIndex)
function! SwitchFlowOrTsLsps(flowIndex)
silent let stats = CocAction("extensionStats")
silent let tsserver = get(filter(copy(stats), function('FindTsServer')), 0)
if(a:flowIndex == 0)
if(tsserver.state == 'disabled')
call CocActionAsync("toggleExtension", "coc-tsserver")
endif
else
if(tsserver.state == 'activated')
call CocActionAsync("toggleExtension", "coc-tsserver")
endif
endif
endfunction
function! FindTsServer(idx, value)
return a:value.id == 'coc-tsserver'
endfunction
let $FZF_DEFAULT_OPTS='--layout=reverse'
let g:fzf_layout = { 'window': 'call FloatingFZF()' }
function! FloatingFZF()
let buf = nvim_create_buf(v:false, v:true)
call setbufvar(buf, '&signcolumn', 'no')
let height = float2nr((&lines - 3) / 2)
let width = float2nr(&columns - (&columns * 2 / 10))
let col = float2nr((&columns - width) / 2)
let row = float2nr((&lines - height) / 2)
let opts = {
\ 'relative': 'editor',
\ 'row': row,
\ 'col': col,
\ 'width': width,
\ 'height': height
\ }
call nvim_open_win(buf, v:true, opts)
endfunction
function! SearchPatternInFile(pattern)
" Save cursor position.
let save_cursor = getcurpos()
" Set cursor position to beginning of file.
call cursor(0, 0)
" Search for the string 'hello' with a flag c. The c flag means that a
" match at the cursor position will be accepted.
let search_result = search(a:pattern, "c")
" Set the cursor back at the saved position. The setpos function was
" used here because the return value of getcurpos can be used directly
" with it, unlike the cursor function.
call setpos('.', save_cursor)
" If the search function didn't find the pattern, it will have
" returned 0, thus it wasn't found. Any other number means that an instance
" has been found.
return search_result
endfunction
How could I solve it?, thanks to all.
Can you try running this command on vim and see if it works?
:CocInstall coc-json coc-tsserver

How to move comment to new file with awk/sed/perl/etc.?

I want to extract comment from SCSS file put them on a new markdown file and remove the comments from original file.
file.scss
/***
* # Typography
* We use
* [Roboto](https://fonts.google.com/specimen/Roboto)
*/
/**
* Body typography:
* `p`
*
* #example
* p This is a paragraph with #[strong bold ] and#[em italic ] styles.</p>
*/
body {
color: $base-font-color;
}
/**
* Heading 1:
* `h1` `.h1`
*/
h1,
.h1 {
#include h1;
}
Expected result
At the end of the process I would like to have:
Comments.md
# Typography
* We use
[Roboto](https://fonts.google.com/specimen/Roboto)
Body typography:
`p`
#example
p This is a paragraph with #[strong bold ] and#[em italic ] styles.</p>
Heading 1:
`h1` `.h1`
file.scss
body {
color: $base-font-color;
}
h1,
.h1 {
#include h1;
}
Question
How can I do that with awk, perl, sed or other tools?
I implement a solution myself
#!/usr/bin/env bash
# USAGE
# ## Development
#
# # single file
# bash ./scripts/extract-md.bash src/base/_typography.scss
#
# # all files
# bash ./scripts/extract-md.bash src/base/_typography.scss
#
# ## production (override files)
#
# export PRODUCTION=true
# bash ./scripts/extract-md.bash
shopt -s globstar
start() {
for legacy in $legacies; do
directory="${legacy%/*}"
filename="${legacy##*/}"
new_filename="${filename//.scss/.md}"
documentation="${directory}/${new_filename}"
extract_comment "$legacy" "$documentation"
stylesheet="${1//.scss/.new.scss}"
extract_code "$legacy" "$stylesheet"
[[ $PRODUCTION ]] && mv "$stylesheet" "$legacy"
done
}
extract_comment() {
local legacy="$1"
local documentation="$2"
awk '/^\/\*/{flag=1} flag; /^\s?\*\//{print;flag=0}' "$legacy" \
| perl -p -e 's/\/[\*]+//g' \
| perl -p -e 's/^\s*[\*]?[ \/]?//g' \
> "$documentation"
}
extract_code() {
local legacy="$1"
local stylesheet="$2"
awk 'BEGIN{flag=1}/^\/\*/{flag=0}; /^\s?\*\//{flag=1; next}flag' "$legacy" \
> "$stylesheet"
}
legacies=${1:-src/**/*.scss}
start $legacies

How do you list out all output / generate files from a Gradle Build?

Currently I am using the following to generate list of output files which I want for another plugin which does Github releases.
[
"${buildDir}/libs/${project.name}-${project.version}.jar",
"${buildDir}/libs/${project.name}-${project.version}-javadoc.jar",
"${buildDir}/libs/${project.name}-${project.version}-sources.jar"
]
I am not very satisfied with this as I am manually specifying each type of file (doc, source, class). I am looking to make this more generic where I can reuse without any modification for any project which might have more or less outputs and also may not be in the default location and some outputs may not even be Java outputs. I.e. changing output location, the tasks to run or plugging elsewhere in the script should not break this part of the script and should be reusable without editing. The question is how do you get a list of all the outputs as a List of String like above.
More detailed code snippet:
...
plugins {
id 'co.riiid.gradle' version '0.4.2'
}
...
ext {
org = 'MicroTrader'
repo = org + '/' + project.name
releaseNotesFile = 'RELEASE_NOTES.md'
host = 'github.com'
hostUrl = 'https://' + host + '/'
orgUrl = hostUrl + org
websiteUrl = hostUrl + repo
vcsUrl = websiteUrl + '.git'
scmUrl = 'scm:git#' + host + ':' + repo + '.git'
issueTrackerUrl = websiteUrl + '/issues'
ossrhUsername = ((project.hasProperty('ossrhUsername') ? ossrhUsername : System.getenv('OSSRH_USER')) ?: System.getProperty('ossrh.user')) ?: ' '
ossrhPassword = ((project.hasProperty('ossrhPassword') ? ossrhPassword : System.getenv('OSSRH_PASSWORD')) ?: System.getProperty('ossrh.password')) ?: ' '
bintray_user = ((project.hasProperty('bintray_user') ? bintray_user : System.getenv('BINTRAY_USER')) ?: System.getProperty('bintray.user')) ?: ' '
bintray_api_key = ((project.hasProperty('bintray_api_key') ? bintray_api_key : System.getenv('BINTRAY_KEY')) ?: System.getProperty('bintray.apikey')) ?: ' '
artifactory_user = ((project.hasProperty('artifactory_user') ? artifactory_user : System.getenv('ARTIFACTORY_USER')) ?: System.getProperty('artifactory.user')) ?: ' '
artifactory_password = ((project.hasProperty('artifactory_password') ? artifactory_password : System.getenv('ARTIFACTORY_PASSWORD')) ?: System.getProperty('artifactory.password')) ?: ' '
github_api_key = ((project.hasProperty('github_api_key') ? github_api_key : System.getenv('GITHUB_KEY')) ?: System.getProperty('github.apikey')) ?: ' '
}
...
github {
owner = project.org
repo = project.name
token = project.github_api_key
tagName = project.version
targetCommitish = 'master'
name = 'v' + project.version
body = Files.exists(Paths.get('' + projectDir + '/' + releaseNotesFile)) ?
new File('' + projectDir + '/' + releaseNotesFile).text :
(Files.exists(Paths.get('' + baseDir + '/' + releaseNotesFile)) ?
new File('' + baseDir + '/' + releaseNotesFile).text : '')
assets = [
"${buildDir}/libs/${project.name}-${project.version}.jar",
"${buildDir}/libs/${project.name}-${project.version}-javadoc.jar",
"${buildDir}/libs/${project.name}-${project.version}-sources.jar"
]
}
...
Try reading the outputs property on all of the tasks in your build used to generate the artifacts:
project(':my-sub-project').jar.outputs
Another option is to use the archives configuration from all of your sub-projects:
project(':my-sub-project').configurations.archives.allArtifacts

Yocto's ROOTFS_POSTPROCESS_COMMAND not working?

I'm trying to use this variable in order to remove a few unwanted init files after my root FS is generated, following the documentation at:
http://www.yoctoproject.org/docs/1.8/ref-manual/ref-manual.html#migration-1.6-variable-changes-variable-entry-behavior
I've added exactly the same snippet to my recipe (.bb) file, without any luck... what's wrong? This is the code I'm putting in my .bb file:
my_postprocess_function() {
echo "hello" > ${IMAGE_ROOTFS}/hello.txt
}
ROOTFS_POSTPROCESS_COMMAND += "my_postprocess_function; "
The logs don't show any kind of error or warning, just my_postprocess_function is not executed.
I believe there is a bug that manifests itself based on which column you put the closing curly bracket in. Initially, I could not believe that this is the behaviour, but after I tested and confirmed it, here are my results:
$ bitbake --version
BitBake Build Tool Core version 1.28.0
I'm modifying core-image-minimal.bb as follows:
FAILING CASE
SUMMARY = "G5 - A small image just capable of allowing a device to boot."
IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
IMAGE_LINGUAS = " "
LICENSE = "MIT"
IMAGE_ROOTFS_SIZE ?= "8192"
IMAGE_ROOTFS_EXTRA_SPACE_append = "${#bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}"
inherit core-image
my_postprocess_function() {
echo "hello" > ${IMAGE_ROOTFS}/hello.txt
}
ROOTFS_POSTPROCESS_COMMAND += "my_postprocess_function; "
The above fails silently and does not generate hello.txt
Notice how the } is indented by one space (indenting by any amount other than once space will also fail).
However, if you modify it as follows:
SUCCEEDING CASE
SUMMARY = "G5 - A small image just capable of allowing a device to boot."
IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
IMAGE_LINGUAS = " "
LICENSE = "MIT"
IMAGE_ROOTFS_SIZE ?= "8192"
IMAGE_ROOTFS_EXTRA_SPACE_append = "${#bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}"
inherit core-image
my_postprocess_function() {
echo "hello" > ${IMAGE_ROOTFS}/hello.txt
}
ROOTFS_POSTPROCESS_COMMAND += "my_postprocess_function; "
then, hello.txt is generated.
The way I found this bug is by moving the 'inherit core-image' line to the end of the file as follows:
DIAGNOSIS
SUMMARY = "G5 - A small image just capable of allowing a device to boot."
IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
IMAGE_LINGUAS = " "
LICENSE = "MIT"
IMAGE_ROOTFS_SIZE ?= "8192"
IMAGE_ROOTFS_EXTRA_SPACE_append = "${#bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}"
my_postprocess_function() {
echo "hello" > ${IMAGE_ROOTFS}/hello.txt
}
ROOTFS_POSTPROCESS_COMMAND += "my_postprocess_function; "
inherit core-image
In which case, I got the error:
ERROR: ParseError at ......./recipes-core/images/core-image-minimal.bb:13: Shell function my_postprocess_function is never closed
I mentioned this last part in case anyone else is having weird behaviour and you have exhausted all debugging possibilities.
cyberguijarro only says that his code exists in a .bb recipe but didn't say if that recipe was an image recipe or not.
Since he didn't accept any of the given answers, I'll suggest that his issue was that his code was not in an image recipe.
This is working for me:
my_postprocess_function() {
echo "hello" > ${IMAGE_ROOTFS}/hello.txt
}
ROOTFS_POSTPROCESS_COMMAND_append = " \
my_postprocess_function; \
"