Skip to content

Commit 8d265e5

Browse files
committed
👍 Add functions in textprop.txt on Vim
1 parent 7fce3b2 commit 8d265e5

File tree

3 files changed

+290
-0
lines changed

3 files changed

+290
-0
lines changed

denops_std/function/vim/_generated.ts

Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,3 +1332,291 @@ export function typename(denops: Denops, expr: unknown): Promise<unknown>;
13321332
export function typename(denops: Denops, ...args: unknown[]): Promise<unknown> {
13331333
return denops.call("typename", ...args);
13341334
}
1335+
1336+
/**
1337+
* Attach a text property at position {lnum}, {col}. {col} is
1338+
* counted in bytes, use one for the first column.
1339+
* If {lnum} is invalid an error is given.
1340+
* If {col} is invalid an error is given.
1341+
* {props} is a dictionary with these fields:
1342+
* length length of text in bytes, can only be used
1343+
* for a property that does not continue in
1344+
* another line; can be zero
1345+
* end_lnum line number for the end of text (inclusive)
1346+
* end_col column just after the text; not used when
1347+
* "length" is present; when {col} and "end_col"
1348+
* are equal, and "end_lnum" is omitted or equal
1349+
* to {lnum}, this is a zero-width text property
1350+
* bufnr buffer to add the property to; when omitted
1351+
* the current buffer is used
1352+
* id user defined ID for the property; must be a
1353+
* number; when omitted zero is used
1354+
* type name of the text property type
1355+
* All fields except "type" are optional.
1356+
* It is an error when both "length" and "end_lnum" or "end_col"
1357+
* are given. Either use "length" or "end_col" for a property
1358+
* within one line, or use "end_lnum" and "end_col" for a
1359+
* property that spans more than one line.
1360+
* When neither "length" nor "end_col" are given the property
1361+
* will be zero-width. That means it will move with the text, as
1362+
* a kind of mark. One character will be highlighted, if the
1363+
* type specifies highlighting.
1364+
* The property can end exactly at the last character of the
1365+
* text, or just after it. In the last case, if text is appended
1366+
* to the line, the text property size will increase, also when
1367+
* the property type does not have "end_incl" set.
1368+
* "type" will first be looked up in the buffer the property is
1369+
* added to. When not found, the global property types are used.
1370+
* If not found an error is given.
1371+
* Can also be used as a |method|:
1372+
* GetLnum()->prop_add(col, props)
1373+
*/
1374+
export function prop_add(
1375+
denops: Denops,
1376+
lnum: unknown,
1377+
col: unknown,
1378+
props: unknown,
1379+
): Promise<unknown>;
1380+
export function prop_add(denops: Denops, ...args: unknown[]): Promise<unknown> {
1381+
return denops.call("prop_add", ...args);
1382+
}
1383+
1384+
/**
1385+
* Remove all text properties from line {lnum}.
1386+
* When {lnum-end} is given, remove all text properties from line
1387+
* {lnum} to {lnum-end} (inclusive).
1388+
* When {props} contains a "bufnr" item use this buffer,
1389+
* otherwise use the current buffer.
1390+
* Can also be used as a |method|:
1391+
* GetLnum()->prop_clear()
1392+
*/
1393+
export function prop_clear(
1394+
denops: Denops,
1395+
lnum: unknown,
1396+
lnum_end?: unknown,
1397+
props?: unknown,
1398+
): Promise<unknown>;
1399+
export function prop_clear(
1400+
denops: Denops,
1401+
...args: unknown[]
1402+
): Promise<unknown> {
1403+
return denops.call("prop_clear", ...args);
1404+
}
1405+
1406+
/**
1407+
* Search for a text property as specified with {props}:
1408+
* id property with this ID
1409+
* type property with this type name
1410+
* both "id" and "type" must both match
1411+
* bufnr buffer to search in; when present a
1412+
* start position with "lnum" and "col"
1413+
* must be given; when omitted the
1414+
* current buffer is used
1415+
* lnum start in this line (when omitted start
1416+
* at the cursor)
1417+
* col start at this column (when omitted
1418+
* and "lnum" is given: use column 1,
1419+
* otherwise start at the cursor)
1420+
* skipstart do not look for a match at the start
1421+
* position
1422+
* A property matches when either "id" or "type" matches.
1423+
* {direction} can be "f" for forward and "b" for backward. When
1424+
* omitted forward search is performed.
1425+
* If a match is found then a Dict is returned with the entries
1426+
* as with prop_list(), and additionally an "lnum" entry.
1427+
* If no match is found then an empty Dict is returned.
1428+
*/
1429+
export function prop_find(
1430+
denops: Denops,
1431+
props: unknown,
1432+
direction?: unknown,
1433+
): Promise<unknown>;
1434+
export function prop_find(
1435+
denops: Denops,
1436+
...args: unknown[]
1437+
): Promise<unknown> {
1438+
return denops.call("prop_find", ...args);
1439+
}
1440+
1441+
/**
1442+
* Return a List with all text properties in line {lnum}.
1443+
* When {props} contains a "bufnr" item, use this buffer instead
1444+
* of the current buffer.
1445+
* The properties are ordered by starting column and priority.
1446+
* Each property is a Dict with these entries:
1447+
* col starting column
1448+
* length length in bytes, one more if line break is
1449+
* included
1450+
* id property ID
1451+
* type name of the property type, omitted if
1452+
* the type was deleted
1453+
* start when TRUE property starts in this line
1454+
* end when TRUE property ends in this line
1455+
* When "start" is zero the property started in a previous line,
1456+
* the current one is a continuation.
1457+
* When "end" is zero the property continues in the next line.
1458+
* The line break after this line is included.
1459+
* Can also be used as a |method|:
1460+
* GetLnum()->prop_list()
1461+
*/
1462+
export function prop_list(
1463+
denops: Denops,
1464+
lnum: unknown,
1465+
props?: unknown,
1466+
): Promise<unknown>;
1467+
export function prop_list(
1468+
denops: Denops,
1469+
...args: unknown[]
1470+
): Promise<unknown> {
1471+
return denops.call("prop_list", ...args);
1472+
}
1473+
1474+
/**
1475+
* Remove a matching text property from line {lnum}. When
1476+
* {lnum-end} is given, remove matching text properties from line
1477+
* {lnum} to {lnum-end} (inclusive).
1478+
* When {lnum} is omitted remove matching text properties from
1479+
* all lines (this requires going over all lines, thus will be a
1480+
* bit slow for a buffer with many lines).
1481+
* {props} is a dictionary with these fields:
1482+
* id remove text properties with this ID
1483+
* type remove text properties with this type name
1484+
* both "id" and "type" must both match
1485+
* bufnr use this buffer instead of the current one
1486+
* all when TRUE remove all matching text properties,
1487+
* not just the first one
1488+
* A property matches when either "id" or "type" matches.
1489+
* If buffer "bufnr" does not exist you get an error message.
1490+
* If buffer "bufnr" is not loaded then nothing happens.
1491+
* Returns the number of properties that were removed.
1492+
* Can also be used as a |method|:
1493+
* GetProps()->prop_remove()
1494+
*/
1495+
export function prop_remove(
1496+
denops: Denops,
1497+
props: unknown,
1498+
lnum?: unknown,
1499+
lnum_end?: unknown,
1500+
): Promise<unknown>;
1501+
export function prop_remove(
1502+
denops: Denops,
1503+
...args: unknown[]
1504+
): Promise<unknown> {
1505+
return denops.call("prop_remove", ...args);
1506+
}
1507+
1508+
/**
1509+
* Add a text property type {name}. If a property type with this
1510+
* name already exists an error is given. Nothing is returned.
1511+
* {props} is a dictionary with these optional fields:
1512+
* bufnr define the property only for this buffer; this
1513+
* avoids name collisions and automatically
1514+
* clears the property types when the buffer is
1515+
* deleted.
1516+
* highlight name of highlight group to use
1517+
* priority when a character has multiple text
1518+
* properties the one with the highest priority
1519+
* will be used; negative values can be used, the
1520+
* default priority is zero
1521+
* combine when omitted or TRUE combine the highlight
1522+
* with any syntax highlight; when FALSE syntax
1523+
* highlight will not be used
1524+
* start_incl when TRUE inserts at the start position will
1525+
* be included in the text property
1526+
* end_incl when TRUE inserts at the end position will be
1527+
* included in the text property
1528+
* Can also be used as a |method|:
1529+
* GetPropName()->prop_type_add(props)
1530+
*/
1531+
export function prop_type_add(
1532+
denops: Denops,
1533+
name: unknown,
1534+
props: unknown,
1535+
): Promise<unknown>;
1536+
export function prop_type_add(
1537+
denops: Denops,
1538+
...args: unknown[]
1539+
): Promise<unknown> {
1540+
return denops.call("prop_type_add", ...args);
1541+
}
1542+
1543+
/**
1544+
* Change properties of an existing text property type. If a
1545+
* property with this name does not exist an error is given.
1546+
* The {props} argument is just like |prop_type_add()|.
1547+
* Can also be used as a |method|:
1548+
* GetPropName()->prop_type_change(props)
1549+
*/
1550+
export function prop_type_change(
1551+
denops: Denops,
1552+
name: unknown,
1553+
props: unknown,
1554+
): Promise<unknown>;
1555+
export function prop_type_change(
1556+
denops: Denops,
1557+
...args: unknown[]
1558+
): Promise<unknown> {
1559+
return denops.call("prop_type_change", ...args);
1560+
}
1561+
1562+
/**
1563+
* Remove the text property type {name}. When text properties
1564+
* using the type {name} are still in place, they will not have
1565+
* an effect and can no longer be removed by name.
1566+
* {props} can contain a "bufnr" item. When it is given, delete
1567+
* a property type from this buffer instead of from the global
1568+
* property types.
1569+
* When text property type {name} is not found there is no error.
1570+
* Can also be used as a |method|:
1571+
* GetPropName()->prop_type_delete()
1572+
*/
1573+
export function prop_type_delete(
1574+
denops: Denops,
1575+
name: unknown,
1576+
props?: unknown,
1577+
): Promise<unknown>;
1578+
export function prop_type_delete(
1579+
denops: Denops,
1580+
...args: unknown[]
1581+
): Promise<unknown> {
1582+
return denops.call("prop_type_delete", ...args);
1583+
}
1584+
1585+
/**
1586+
* Returns the properties of property type {name}. This is a
1587+
* dictionary with the same fields as was given to
1588+
* prop_type_add().
1589+
* When the property type {name} does not exist, an empty
1590+
* dictionary is returned.
1591+
* {props} can contain a "bufnr" item. When it is given, use
1592+
* this buffer instead of the global property types.
1593+
* Can also be used as a |method|:
1594+
* GetPropName()->prop_type_get()
1595+
*/
1596+
export function prop_type_get(
1597+
denops: Denops,
1598+
name: unknown,
1599+
props?: unknown,
1600+
): Promise<unknown>;
1601+
export function prop_type_get(
1602+
denops: Denops,
1603+
...args: unknown[]
1604+
): Promise<unknown> {
1605+
return denops.call("prop_type_get", ...args);
1606+
}
1607+
1608+
/**
1609+
* Returns a list with all property type names.
1610+
* {props} can contain a "bufnr" item. When it is given, use
1611+
* this buffer instead of the global property types.
1612+
*/
1613+
export function prop_type_list(
1614+
denops: Denops,
1615+
props?: unknown,
1616+
): Promise<unknown>;
1617+
export function prop_type_list(
1618+
denops: Denops,
1619+
...args: unknown[]
1620+
): Promise<unknown> {
1621+
return denops.call("prop_type_list", ...args);
1622+
}

scripts/gen-function/format.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const translate: Record<string, string> = {
55
"delete": "delete_",
66
"eval": "eval_",
77
"function": "function_",
8+
"lnum-end": "lnum_end",
89
};
910

1011
function formatDocs(docs: string): string[] {

scripts/gen-function/gen-function.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const manualFnSet = new Set([
2121

2222
const vimHelps = await Promise.all([
2323
`https://raw.githubusercontent.com/vim/vim/v${VIM_VERSION}/runtime/doc/eval.txt`,
24+
`https://raw.githubusercontent.com/vim/vim/v${VIM_VERSION}/runtime/doc/textprop.txt`,
2425
].map(downloadString));
2526
const vimDefs = vimHelps.map(parse).flat();
2627
const vimFnSet = difference(new Set(vimDefs.map((def) => def.fn)), manualFnSet);

0 commit comments

Comments
 (0)