|
| 1 | +<!-- |
| 2 | + © 2024 Intel Corporation |
| 3 | + SPDX-License-Identifier: Apache-2.0 and MIT |
| 4 | +--> |
| 5 | +# Usage Instructions |
| 6 | +This document describes general instructions and advice directed at |
| 7 | +end-users of the DML language server. For advice or details on |
| 8 | +client implementation see [clients.md](clients.md). This document |
| 9 | +_only_ pertains to details that are client-agnostic. For client-specific |
| 10 | +details consult the documentation of the client. |
| 11 | + |
| 12 | +As this file is currently a work in progress, relevant details may be |
| 13 | +missing or incomplete. |
| 14 | + |
| 15 | +## In-Line Linting Configuration |
| 16 | +It may be desireable to control linting on a per-file basis, rather than |
| 17 | +relying on the linting configuration. This can be done with in-line |
| 18 | +linting configuration inside comments. |
| 19 | + |
| 20 | +The general syntax is: |
| 21 | +`// dls-lint: <command>=<target>` |
| 22 | +Note that only one-line comments are allowed, and only if no text is between |
| 23 | +the comment start and 'dls-lint'. |
| 24 | + |
| 25 | +Currently supported commands are: |
| 26 | +* 'allow-file' Will not report the lint rule specified by \<target> for the |
| 27 | + entire file, regardless of where 'allow-file' is declared |
| 28 | +* 'allow' Will not report the lint rule specified by <target> for the next |
| 29 | + line without a leading comment, or for the current line if declared |
| 30 | + outside a leading comment. |
| 31 | + |
| 32 | +Lint warnings will report which rule caused them in their message, which is the |
| 33 | +same identifier used for \<target>. |
| 34 | + |
| 35 | +For example |
| 36 | +``` |
| 37 | +// dls-lint: allow-file=long_lines |
| 38 | +method now_we_can_declare_this_method_with_a_really_really_really_really_long name() { |
| 39 | +
|
| 40 | +// dls-lint: allow=nsp_unary |
| 41 | +// dls-lint: allow=indent_no_tabs |
| 42 | + param p = (1 ++ * |
| 43 | + 4); // dls-lint: allow=indent_paren_expr |
| 44 | +} |
| 45 | +``` |
| 46 | +Will allow 'long_lines' globally, 'nsp_unary' and 'indent_no_tabs' on the |
| 47 | +`param p = (1 ++ *` line, and 'indent_paren_expr' on the `'4);` line. |
0 commit comments