annotate runtime/autoload/freebasic.vim @ 27796:8fdc92bdcff1 v8.2.4424

patch 8.2.4424: ".gts" and ".gjs" files are not recognized Commit: https://github.com/vim/vim/commit/cdf717283ca70b18f20b8a2cefe7957083280c6f Author: NullVoxPopuli <LPSego3+dev@gmail.com> Date: Sat Feb 19 16:35:58 2022 +0000 patch 8.2.4424: ".gts" and ".gjs" files are not recognized Problem: ".gts" and ".gjs" files are not recognized. Solution: Recognize Glimmer flavored typescript and javascript. (closes #9799)
author Bram Moolenaar <Bram@vim.org>
date Sat, 19 Feb 2022 17:45:05 +0100
parents 5825405e4e2c
children 912224cab37f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27459
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim filetype plugin file
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: FreeBASIC
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Last Change: 2021 Mar 16
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 " Dialects can be one of fb, qb, fblite, or deprecated
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 " Precedence is forcelang > #lang > lang
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 function! freebasic#GetDialect() abort
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 if exists("g:freebasic_forcelang")
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 return g:freebasic_forcelang
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 endif
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 if exists("g:freebasic_lang")
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 let dialect = g:freebasic_lang
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 else
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 let dialect = "fb"
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 endif
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 " override with #lang directive or metacommand
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 let skip = "has('syntax_items') && synIDattr(synID(line('.'), col('.'), 1), 'name') =~ 'Comment$'"
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 let pat = '\c^\s*\%(#\s*lang\s\+\|''\s*$lang\s*:\s*\)"\([^"]*\)"'
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 let save_cursor = getcurpos()
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 call cursor(1, 1)
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 let lnum = search(pat, 'n', '', '', skip)
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 call setpos('.', save_cursor)
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 if lnum
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 let word = matchlist(getline(lnum), pat)[1]
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 if word =~? '\%(fb\|deprecated\|fblite\|qb\)'
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 let dialect = word
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 else
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 echomsg "freebasic#GetDialect: Invalid lang, found '" .. word .. "' at line " .. lnum .. " " .. getline(lnum)
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 endif
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 endif
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 return dialect
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 endfunction
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: