Vim as ide for mql - page 10

 
Dmitry Fedoseev:

Wanted to ask what is vim...


exactly what it is, couldn't close it, freaked out, deleted it.

I have no idea who came up with that bastard and I don't want to.

 

Nah, the μl is some kind of under-language. Why did they have to mess it up so badly with all these kind of improvements? I started to use my own thing, and it turns out that the templates werecrooked in particular, it really pisses the hose off:

template <typename T>
class Q {
public:
  void fn() {}
};
template <typename T> void Q<T>::fn() {}  // запрещено по плюсовому
template <typename T> void Q::fn() {}

Couldn't they have done it stupidly like in the pros. In general I'm tired of struggling with all these chips and using stream editors to modify code. Maybe someone will find it useful - attached vim.mqh with all declarations of µl.

Files:
vim.mqh  87 kb
 
Vict:

Nah, the μl is some kind of under-language. Why did they have to mess it up so badly with all these kind of improvements? I started to use my own thing, and it turns out that the templates werecrooked in particular, it really pisses the hose off:

Couldn't they have done it stupidly like in the pros. In general I'm tired of struggling with all these chips and using stream editors to modify code. Maybe someone may find it useful - attached vim.mqh with all µl declarations.

Maybe you should visit a different forum?
Or maybe you just don't know how to express your claims properly - without school canteen epithets?
 

Guys, I've decided to finish it up. The main changes are

1. Declare member functions of the template classes as they should be:

template <typename Tr_, typename Cbspec_>
double Trend3_cml<Tr_, Cbspec_>::get_breakprice() {}

2. I decided not to make any serious edits to the std files, just cut them off from the clang parser when turning them on:

#ifndef  VIM
#include <Object.hh>
#endif

if you want type hints from there, you should make corresponding declarations (I don't need them).


README file:

//--------------------------------------------------------------
// Описание                                                    |
//--------------------------------------------------------------
1. Компиляция (общая схема процесса)
   F7->clang препроцессор->правка исходников потоковыми
   редакторами(во временном файле)->mql препроцессор/компилятор.
   Просмотр ошибок :copen или :clist
2. Правка исходников. Цель - максимально писать в c++ подобном
   стиле (дабы угодить clang анализатору, да и приятней как-то),
   для этого (исходники правятся автоматически при каждой
   компиляции, во временном файле):
   * меняем -> на .
   * добавляется амперсанд при передаче массива в функцию
   * убираем угловые скобки при объявлении функции-члена
     шаблонного класса (во второй строке)
   -------------code begin-----------
   template <typename Tr_, typename Cbspec_>
   double Trend3_cml<Tr_, Cbspec_>::get_breakprice() {}

   void f(Type ar[]) {}

   ptr->call()
   -------------code end-------------
3. Рекомендую использовать расширение hh для заголовочных
   файлов, так будет подсказка при вводе имени файла при
   его включении.
4. Запись мкл специфичных конструкций
   Во время написания кода в виме определён макрос VIM,
   благодаря которому можно прятать от clang анализатора
   ошибочные (с его точки зрения) конструкции:
   -------------code begin-----------
   #ifndef VIM
   input int i;  // input мкл специфичная
   #else
   int i;
   #endif
   -------------code end-------------
   В такое же макроусловие оборачиваем включение файлов
   стандартной библиотеки (там может быть что угодно,
   clang анализатор может споткнуться).
   -------------code begin-----------
   #ifndef VIM
   #include <Object.hh>
   #endif
   -------------code end-------------
5. Передача директив мкл препроцессору. Во время правки
   исходников префикс mqlcpp_ будет удалён.
   -------------code begin-----------
   #ifndef VIM
   mqlcpp_#property strict
   #endif
   -------------code end-------------
6. При первой компиляции в файлы стандартной библиотеки
   добавляются include guard'ы (первая компиляция - нет
   guard'а в Object.mqh). Пользовательские файлы не
   модифицируются, поддиректории MQL/Include с пользовательскими
   данными задаются через compile_mql::user_include_subdir. В свои
   mqh добавлять guard'ы самостоятельно. Также при первой
   компиляции будет изменено расширение файлов стд на hh,
   если compile_mql::subst_std_extension='1'.
7. Подавление предупреждений мкл компилятора. Коды
   предупреждений задаются через compile_mql::waring_black_list
8. Автокомплит, переход к определению, ... реализованы через 
   clangd(lsp сервер)<--> coc(lsp клиент). Основные сочетания
   клавиш
     gd - defenition
     gy - type defenition
     gy - implementation
     gr - reference
     K  - show documentation
     [g - diagnost previous
     ]g - diagnost next
     <leadir> rn - rename    (у меня leadir - ,)
     <space> a - diagnost list
     <space> o - outline list
     <space> s - symbol list
9. Кодировка исходников должна быть utf-8 (mqh из std
   конвертируются автоматически). Для пользовательских файлов
   $ dos2unix file1 file2 ...
//--------------------------------------------------------------
// Установка                                                   |
//--------------------------------------------------------------
1. Зависимости: clang, clangd, dos2unix, nodejs, neovim
2. Cоздаём ссылку без пробелов на Meta Trader/MQL, указываем
   путь к ссылке в compile_mql::mql_link
   (дефолтно mql_link="$HOME/.wine/MQL5")
3. Копируем файлы в соответствующие директории (compile_mql, ..).
   vim.hh кидаем в поддиректорию Include (у меня это
   Include/myincl) (он должен быть включён в каждый 
   скрипт/эксперт).
4. В виме выполнить :PlugInstall
5. В MQL/Include создаём compile_flags.txt с содержимым (вместо
   YOUR_HOME_DIR вписать свою домашнюю директорию, ${HOME} не
   работает):
     -xc++-header
     -IYOUR_HOME_DIR/.wine/MQL5/Include
     -DVIM
6. В директории со скриптами/экспертами создаём
   compile_flags.txt с содержимым:
     -xc++
     -IYOUR_HOME_DIR/.wine/MQL5/Include
     -DVIM
7. Правим compile_mql::user_include_subdir (дефолтно ''),
   делаем компиляцию чего-нибудь (для вставки guard'ов в стд),
   иначе правильная работа невозможна.


HH: vim.hh contains all declarations except std, i.e. auto-complete.

#vim_as_mql_ide_4

Files:
 
I used to think that C++ programmers were people with a flexible and bright mind... Turns out not everyone is.
 
Dmitry Fedoseev:
I used to think that C++ programmers were people with a flexible and bright mind... Turns out not everyone is.

Can you do C++? Yeah, surprise me.

 
Vict:

Do you know C++? Yeah, you surprised me.

What difference does it make to programming in what (language) and in what IDE, the main thing is not the environment, but the head!

I, for example, programmed in Pascal (Delphi) when I first got acquainted with ME (MT5),

In three minutes I was programming like in my native language.

When a cat has nothing to do, it licks its balls...

 
prostotrader:

What difference does it make to programming in what (language) and in what IDE, the main thing is not the environment, but the head!

I, for example, programmed in Pascal (Delphi) when I first got acquainted with ME (MT5),

In three minutes I was programming like in my native language.

When a cat has nothing to do, it licks its balls...

It's hard to explain to people who don't know how to use vim. It's not just an editor and you get addicted to it, it becomes anatomically uncomfortable to skim with a mouse in 'notepads'. I just want a handy tool, in my opinion, a normal desire.

Honestly, when I see MetaEditor opening up, the desire to code diminishes, which negatively affects productivity, why would I want that annoying factor?
 
Vict:

It's hard to explain to people who don't know how to use vim. It's not just an editor and you get addicted to it, it becomes anatomically uncomfortable to skim with a mouse in "notepads". I just want a handy tool, in my opinion, a normal desire.

Honestly, when I see MetaEditor opening up, the desire to code diminishes, which negatively affects productivity, why would I want that annoying factor?

You don't need to explain anything!

You like vim, fine, use it,

but that's not enough for you, you've begun to impose your views on other people.

There is no point in going any further.

 
prostotrader:

You don't need to explain anything!

You like vim, fine, use it,

but that's not enough for you, you've started to impose your views on other people.

There is no need to go on.

:) I'm not imposing anything on you, you came to my thread. You were not forced to come here, whether to continue is up to me.

Reason: