Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Java Properties language for .properties extension #4098

Merged
merged 5 commits into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion lib/linguist/heuristics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,20 @@ disambiguations:
- pattern: SOURCES
- language: IDL
pattern: '^\s*function[ \w,]+$'
- extensions: ['.properties']
rules:
- language: INI
and:
- named_pattern: key_equals_value
- pattern: '^[;\[]'
- language: Java Properties
and:
- named_pattern: key_equals_value
- pattern: '^[#!]'
- language: INI
named_pattern: key_equals_value
- language: Java properties
pattern: '^[^#!][^:]*:'
- extensions: ['.props']
rules:
- language: XML
Expand Down Expand Up @@ -393,6 +407,7 @@ named_patterns:
- '^[ \t]*(private|public|protected):$'
- 'std::\w+'
fortran: '^(?i:[c*][^abd-z]| (subroutine|program|end|data)\s|\s*!)'
key_equals_value: '^[^#!;][^=]*='
objectivec: '^\s*(@(interface|class|protocol|property|end|synchronised|selector|implementation)\b|#import\s+.+\.h[">])'
perl5: '\buse\s+(?:strict\b|v?5\.)'
perl6: '^\s*(?:use\s+v6\b|\bmodule\b|\b(?:my\s+)?class\b)'
perl6: '^\s*(?:use\s+v6\b|\bmodule\b|\b(?:my\s+)?class\b)'
9 changes: 9 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2208,6 +2208,15 @@ Java:
extensions:
- ".java"
language_id: 181
Java Properties:
type: data
extensions:
- ".properties"
tm_scope: source.java-properties
ace_mode: properties
codemirror_mode: properties
codemirror_mime_type: text/x-properties
language_id: 519377561
Java Server Pages:
type: programming
group: Java
Expand Down
86 changes: 86 additions & 0 deletions samples/INI/defaults.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
; -------------------------------------
; These taskdefs are loaded at startup.
; -------------------------------------

; Internal system tasks
;
adhoc=phing.tasks.system.AdhocTask
adhoc-task=phing.tasks.system.AdhocTaskdefTask
adhoc-type=phing.tasks.system.AdhocTypedefTask
append=phing.tasks.system.AppendTask
available=phing.tasks.system.AvailableTask
chmod=phing.tasks.system.ChmodTask
chown=phing.tasks.system.ChownTask
concat=phing.tasks.system.AppendTask
condition=phing.tasks.system.ConditionTask
copy=phing.tasks.system.CopyTask
cvs=phing.tasks.system.CvsTask
cvspass=phing.tasks.system.CvsPassTask
delete=phing.tasks.system.DeleteTask
echo=phing.tasks.system.EchoTask
exec=phing.tasks.system.ExecTask
fail=phing.tasks.system.ExitTask
foreach=phing.tasks.system.ForeachTask
includepath=phing.tasks.system.IncludePathTask
input=phing.tasks.system.InputTask
mkdir=phing.tasks.system.MkdirTask
move=phing.tasks.system.MoveTask
phing=phing.tasks.system.PhingTask
phingcall=phing.tasks.system.PhingCallTask
php=phing.tasks.system.PhpEvalTask
property=phing.tasks.system.PropertyTask
propertyprompt=phing.tasks.system.PropertyPromptTask
reflexive=phing.tasks.system.ReflexiveTask
resolvepath=phing.tasks.system.ResolvePathTask
taskdef=phing.tasks.system.TaskdefTask
touch=phing.tasks.system.TouchTask
tstamp=phing.tasks.system.TstampTask
typedef=phing.tasks.system.TypedefTask
uptodate=phing.tasks.system.UpToDateTask
xslt=phing.tasks.system.XsltTask
if=phing.tasks.system.IfTask
warn=phing.tasks.system.WarnTask

; "Core" contributed tasks
; -- i.e. no taskdef needed.

creole=phing.tasks.ext.creole.CreoleSQLExecTask
pdo=phing.tasks.ext.pdo.PDOSQLExecTask
package-as-path=phing.tasks.ext.PackageAsPathTask
smarty=phing.tasks.ext.SmartyTask
capsule=phing.tasks.ext.CapsuleTask
tar=phing.tasks.ext.TarTask
untar=phing.tasks.ext.UntarTask
pearpkg=phing.tasks.ext.PearPackageTask
pearpkg2=phing.tasks.ext.PearPackage2Task
mail=phing.tasks.ext.MailTask
zip=phing.tasks.ext.ZipTask
unzip=phing.tasks.ext.UnzipTask
scpsend=phing.tasks.ext.ScpSendTask

; "ext" tasks
phpdoc=phing.tasks.ext.phpdoc.PhpDocumentorTask
phpdocext=phing.tasks.ext.phpdoc.PhpDocumentorExternalTask
svnlastrevision=phing.tasks.ext.svn.SvnLastRevisionTask
svncheckout=phing.tasks.ext.svn.SvnCheckoutTask
svnexport=phing.tasks.ext.svn.SvnExportTask
svnupdate=phing.tasks.ext.svn.SvnUpdateTask
phpunit3=phing.tasks.ext.phpunit.PHPUnitTask
phpunit3report=phing.tasks.ext.phpunit.PHPUnitReportTask
phpunit2=phing.tasks.ext.phpunit.PHPUnitTask
phpunit2report=phing.tasks.ext.phpunit.PHPUnitReportTask
phpunit=phing.tasks.ext.phpunit.PHPUnitTask
phpunitreport=phing.tasks.ext.phpunit.PHPUnitReportTask
coverage-setup=phing.tasks.ext.coverage.CoverageSetupTask
coverage-merger=phing.tasks.ext.coverage.CoverageMergerTask
coverage-report=phing.tasks.ext.coverage.CoverageReportTask
ioncubeencoder=phing.tasks.ext.ioncube.IoncubeEncoderTask
ioncubelicense=phing.tasks.ext.ioncube.IoncubeLicenseTask
simpletest=phing.tasks.ext.simpletest.SimpleTestTask
phplint=phing.tasks.ext.PhpLintTask
xmllint=phing.tasks.ext.XmlLintTask
analyze=phing.tasks.ext.ZendCodeAnalyzerTask
jsllint=phing.tasks.ext.JslLintTask
manifest=phing.tasks.ext.ManifestTask
phpcodesniffer=phing.tasks.ext.PhpCodeSnifferTask
ftpdeploy=phing.tasks.ext.FtpDeployTask
6 changes: 6 additions & 0 deletions samples/INI/ms.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title=Mindstorms
isbn=0465046290
author=Seymour Papert
pubmonth=198001
subject=children computers powerful ideas LOGO education
url=http://www.papert.org/
33 changes: 33 additions & 0 deletions samples/Java Properties/libraries.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (c) 2009-2011 Couchbase, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

checkstyle.version=5.0

findbugs.version=1.3.9

ivy.version=2.2.0
mvn.version=2.0.10

jmock.version=1.2.0
junit.version=4.7
log4j.version=1.2.16
slf4j.version=1.7.5
spring-beans.version=3.0.3.RELEASE
codahale.metrics.version=3.0.1
15 changes: 15 additions & 0 deletions samples/Java Properties/sounds.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in compliance with the License. You may
# obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
Dink:net/rptools/maptool/client/sound/dink.mp3
Clink:net/rptools/maptool/client/sound/clink.mp3
10 changes: 9 additions & 1 deletion test/test_heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_ecl_by_heuristics
"ECLiPSe" => all_fixtures("ECLiPSe", "*.ecl")
})
end

def test_es_by_heuristics
assert_heuristics({
"Erlang" => all_fixtures("Erlang", "*.es"),
Expand Down Expand Up @@ -325,6 +325,14 @@ def test_pro_by_heuristics
})
end

# Candidate languages = ["INI", "Java Properties"]
def test_properties_by_heuristics
assert_heuristics({
"INI" => all_fixtures("INI", "*.properties"),
"Java Properties" => all_fixtures("Java Properties", "*.properties")
})
end

def test_props_by_heuristics
assert_heuristics({
"INI" => all_fixtures("INI", "*.props"),
Expand Down
1 change: 1 addition & 0 deletions vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **J:** [tikkanz/JSyntax](https://github.com/tikkanz/JSyntax)
- **Jasmin:** [atmarksharp/jasmin-sublime](https://github.com/atmarksharp/jasmin-sublime)
- **Java:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle)
- **Java Properties:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle)
- **Java Server Pages:** [textmate/java.tmbundle](https://github.com/textmate/java.tmbundle)
- **JavaScript:** [atom/language-javascript](https://github.com/atom/language-javascript)
- **JFlex:** [jflex-de/jflex.tmbundle](https://github.com/jflex-de/jflex.tmbundle)
Expand Down